C Programming - Arrays - Discussion
Discussion Forum : Arrays - General Questions (Q.No. 2)
2.
What does the following declaration mean?
int (*ptr)[10];
int (*ptr)[10];
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.
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:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers