Vidyalelo
C Programming · Q42

Arrays and Strings

Programming · C Programming · question 42

Q42

What does the following declaration mean? int (*ptr)[10];

A.
ptr is array of pointers to 10 integers
B.
ptr is a pointer to an array of 10 integers
Answer
C.
ptr is an array of 10 integers
D.
ptr is an pointer to array

Answer: Option B

Solution

Answer: Option B
Solution:
The declaration int (*ptr)[10]; means that ptr is a pointer to an array of 10 integers.

Here's the breakdown:

int specifies the type of elements in the array (integers).
(*ptr) indicates that ptr is a pointer.
[10] specifies that the pointer points to an array of 10 integers.

Thus, ptr is not an array of pointers, nor an array of integers, but a pointer to an array of integers with a size of 10.