I having a lot of trouble trying to figure out this problem. Take a look at this function.
this function will be passed a 2D array of ints but I really can't figure out what is happening because the first line prints out 0xbffffa54 but the next line will print out 0x6, which is the value at twod[0][2].
Here is the array as it is declared in main:
Can someone please explain to me what is going to with *twod + 1? because naturally I would think that it first dereferenced twod then adds 1 to where it points to..... but now I'm really confused. thanks
Code:
void function3(int **twod)
{
printf("twod is: %p\n", twod); // this prints the location of twod
printf("*twod + 1 is: %p\n", *twod + 1);
}
this function will be passed a 2D array of ints but I really can't figure out what is happening because the first line prints out 0xbffffa54 but the next line will print out 0x6, which is the value at twod[0][2].
Here is the array as it is declared in main:
Code:
int twod[4][3] = {{2,4,6}, {8,10,12}, {14, 16, 18}, {20, 22, 24}};
Can someone please explain to me what is going to with *twod + 1? because naturally I would think that it first dereferenced twod then adds 1 to where it points to..... but now I'm really confused. thanks