This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Pointer to 2D array

On Keil C51 compiler using an already posted solution I get the following warning

Mail.c(256): warning C182: pointer to different objects

on "pointer = &tab1;"

int (*pointer)[100][280]; // pointer creation
pointer = &tab1; //assignation
(*pointer)[5][12] = 517; // use
int myint = (*pointer)[5][12]; // use

WHY?

Parents
  • Isn't it a bit fun that the compiler complains about "pointer to different object", but you do not show us what the two objects are?

    We - the readers - can't know what your tab1 is. But we can wonder if you have thought a bit about the use of & before the name of an array variable.

Reply
  • Isn't it a bit fun that the compiler complains about "pointer to different object", but you do not show us what the two objects are?

    We - the readers - can't know what your tab1 is. But we can wonder if you have thought a bit about the use of & before the name of an array variable.

Children