int array[4] array == &array ? [C++]
For:
int array[4];
I had always thought:
array
was the address of the first array element, and
&array
was invalid syntax. However they both seem to compile, and be the address, as notified to me by a co-worker. I can kind of see why the second case works, as "array" is a static array, and thus & takes the address of that object. Still... subtle. :)
Thought I would bring it up in case anyone else hadn't noticed this.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement