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.

Vishwaschaurasiya said:   1 decade ago
int (*ptr)[10];
ptr is a pointer, but this declaration is called pointer of an array..
Since,(*) this is unary oprator,known as (Astrick);

Sasi said:   1 decade ago
int (*ptr) [10].

We can take this a cyclic check and everyone can read it easily by this way.

Start with ptr as it is a pointer go clock wise the next comes as array of size 10 that means ptr is a pointer to an array of 10 and the return type is int so it is finally as:.

ptr is a pointer to an array of 10 integers.

Srilakshmi said:   1 decade ago
Array size is represented in []ie. , no. Of elements contained in it * represents for a pointer so ptr is a pointer to an array of 10 integers since the return type is specified as int.

Rajeev Tomar said:   1 decade ago
Here [10] is the size of array (as in [], always size of array is represesnted) and *ptr is a pointer pointing the particular array. Means there in the memory, there is an array consisting of 10 blocks of integer type and a pointer is pointing to that particular array.

This array would be accessed by that pointer.


Post your comments here:

Your comments will be displayed after verification.