For the below program using, single pointer,
#include <stdio.h>
int main()
{
int b[2][3] = {{1, 2, 3}, {4, 5, 6}};
int *p = b;
printf("\nElement - %d", *(p+3));
printf("\nElement - %d", *(p+4));
}
2D array b
is being accessed successfully using single pointer p
.
I have also been through this answer.
Question:
1)
Did not feel the necessity of pointer to pointer for b
. Is p
suppose to be pointer to pointer, when working with 2Darray b
?
2)
When do we require p
to be pointer to pointer, when working with b
?
3)
Is n level pointer required for n dimensional array?