What will be the output of the following code? int main() {
What will be the output of the following code?
#include <stdio.h>
int main() {
int arr[5] = {10, 20, 30, 40, 50};
int (*p)[5] = &arr;
printf("%d\n", *(*p + 3));
return 0;
}
Show answerHide answer
Correct answer: (A) 40
Explanation
p points to the whole array, so *p is arr (the address of its first element). *p + 3 points to arr[3], and dereferencing gives 40.