Question on pointer usage
I know that when a pointer is incremented, it will point to the next element of its type. e.g:
This is because the addresses of elements of the array are all adjacent.
cout<<*(p+4)<<endl; //will output 5
My question is applying the same principle, why doesn't the following work:
Because the variables are all created at the same line, with nothing in between, does it mean their addresses are also adjacent?
/*The loop should put into int a to h the squares of i as i increments*/