C Programming - Arrays - Discussion

Discussion Forum : Arrays - General Questions (Q.No. 2)
2.
What does the following declaration mean?
int (*ptr)[10];
ptr is array of pointers to 10 integers
ptr is a pointer to an array of 10 integers
ptr is an array of 10 integers
ptr is an pointer to array
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
64 comments Page 7 of 7.

Teja said:   5 years ago
ptr is a pointer which points an array.
(2)

Dinesh Kumar Nayak said:   4 years ago
Agree, B is the right answer.
(3)

Prashanth said:   2 years ago
int ptr[10] means ptr is an array of 10 elements whose datatype is int.
int a;
int *ptr=a; means ptr is a pointer pointing to a which is an integer type.

(int *) ptr[10] means ptr is an array of 10 elements whose datatype is int and they all are pointers.

in (*ptr)[10] means ptr is a pointer which is pointing to 10 elements which are of int datatype.
(11)

Sirish said:   2 years ago
Here, we can observe there is no comma operator ( (*ptr) , [10]) so, we can identify what's the array name, because the array name must be declared. So, *ptr=a, then the array becomes a[10], 10 elements are there in the array "a".
(6)


Post your comments here:

Your comments will be displayed after verification.