Warning when using const pointer to fixed size array

Thomas Martitz thomas.martitz@student.HTW-Berlin.de
Tue Dec 1 00:08:00 GMT 2009


Am 01.12.2009 01:05, schrieb Thomas Martitz:
> Am 01.12.2009 00:46, schrieb me22:
>> 2009/11/30 Thomas Martitz<thomas.martitz@student.htw-berlin.de>:
>>> What address are you taking? "array" already stands for the address 
>>> of the
>>> first element (and is hence sort of a pointer). I'm not sure you can 
>>> take
>>> the address of the array name as I think it doesn't have one.
>>>
>> You can, actually:
>>
>>      int main() {
>>          int a[4];
>>          int (*p)[4] =&a;
>>      }
>
>
> I didn't try gcc, but visual studio compiler gives an error on that one.

Nevermind, I just tried copy&pasting yours and it worked. I guess I used 
something slightly different.



More information about the Gcc-help mailing list