Here is the problem:
#include <stdio.h>
int main()
{
int a[2][2] = { {6, 2}, {3, 4} };
int (**p)[2];
p = a;
for (int i = 0; i < 4; i++) {
printf("%p\n", (*p + i));
printf("%d\n", *(*p + i));
}
return 0;
}
I interpreted int(**p)[2]; as a double pointer to a 1D array of size 2.
I drew this conclusion because:
int *p[2];means an array of integer pointers of size 2.int (*p)[2];means an integer pointer pointing to a 1D array of size 2.
So,
int **p[2];means an array of integer double pointers of size 2.int (**p)[2];means an integer double pointer pointing to a 1D array of size 2.
Out of 1, 2, 3 and 4 statements which are true and which are needed to be corrected?
Consequently, what would be the output of this code?
I tried here.