I just don't get ths behaviour. Lets say we the next snippet:
1 2 3 4 5 6 7 8 9 10 11
...........................
constint MAX = 3;
int main()
{
int var[MAX] = {10, 100, 200};
int *ptr;
ptr = var; // works
ptr = &var[MAX-1]; // works
ptr = var[MAX-1]; // not working
..........................
}
I don't understand why the last assignment doesn't work?
Im not an expert, and Im honestly not sure that Im right, but Im gonna guess its becuase, MAX is an constant, and you cant just change the constant by value. You have to use "&" so you can get to the adress? Thats my guess, I might have frased things a bit weirdly.
Thank you. I understand very well your reply. In my snippet, the first assignment gets into the ptr the memory location of var[1], that is: ptr = var, however ptr = var[MAX-1] doesn't get the memory location of the last entrance in the row vector. :D, This is my dilema.