Hello!
This is actually a question about C and not so much about Qt. I declare a static 2D array of ints like this:
int i[2][2];
i[0][0] = 1;
i[0][1] = 2;
i[1][0] = 3;
i[1][1] = 4;
And now I would like to have a second pointer j, that points to the same array.
int** j = i;
But the compiler doesn't allow me to do that: "cannot convert ‘int (*)[2]’ to ‘int**’ in initialization".
Trying to "hack" it with a memcpy
memcpy((void*)&j, (void*)i, sizeof(long int));
leads to a segmentation fault.
What am I not doing right?
Thanks,
Cruz
Bookmarks