#include <stdio.h>
int main(void)
{
int x[2][3] =
{
{4, 5, 2},
{7, 6, 9}
};
int (*p)[3] = &x[1];
int (*q)[3] = x;
printf("%d %d %d\n", (*p)[0], (*p)[1], (*p)[2]); //7, 6, 9
printf("%d %d\n", *q[0], *q[1]); // 4, 7
return 0;
}
x[0] ----> [4, 5, 2].
x[1] ----> [7, 6, 9]
so if p=X[1], p[0]=7, p[1]=6 and p[2]=9, so the first printf is understandable.
For the second printf, x will be equal to the address first element of the array. If *q[0] is 4, why is *q[1] 7, shouldn't it be 5? It skips a row.
Actual output from link:
7 6 9 4 7
pbe 7, 6 and 9, sinceppoints to the second array inx? Please edit the question to include the actual output (copied and pasted) from the actual program you show in the question.[]have higher precedence than the dereference operator*.