What is the meaning of the following declaration in C programming language?…
2018
What is the meaning of the following declaration in C programming language? int (*p)[5];
- A.
It will result in compile error because there should not be any parenthesis, i.e., int *p[5] is valid
- B.
p is a pointer to 5 integers
- C.
p is a pointer to integer array
- D.
p is a pointer to an array of 5 integers
Attempted by 342 students.
Show answer & explanation
Correct answer: D
Key idea: int (*p)[5] declares p as a pointer to an array of 5 integers. Parentheses around *p make p a pointer; [5] applies to the type pointed to, so p points to an array of 5 int values.