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 1 of 7.

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)

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)

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

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

Ashik said:   5 years ago
Please explain in detail.
(1)

Siva said:   6 years ago
ptr is a pointer variable that can store an array of integer values(i.e. 10 integer values).
(1)

Rupa said:   6 years ago
Could you please explain the question?

Abhishek prajapati said:   6 years ago
As we write ' int a[10] ' then we call it:- a is an array of 10 integer type elements.

Like that we can say in " int (*ptr)[10] "ptr (due to * ptr is pointer variable) is a pointer to an array of 10 integer type elements.
(1)

JAY said:   6 years ago
Could you please explain the question.

Ishtha said:   7 years ago
I can't get your points. Explain more please.


Post your comments here:

Your comments will be displayed after verification.