Incorrect pointer conversion when accessing a[2][2] with *b.
Hi
When running following code, it gives correct output but a warning something like: "Incorrect Pointer Conversion"
Code:
void main()
{
int a[2][2] = {{1,2}, {3,4}}, *b = &a;
printf("*b = %d", *b);
printf("*(b+1) = %d", *(b+1) );
printf("*(b+2) = %d", *(b+2) );
printf("*(b+3) = %d", *(b+3) );
}
please help me out with this, why is this incorrect? And how is a 2d pointer saved in memory? Isnt it in sequence like this - a[0][0], a[0][1], a[1][0], a[1][1]
If this is correct, above method should work just fine ...
Also please tell me all the methods one can use to access an array 2d, 3d anything, from a function ...
Thanks in advance :)