Pelles C forum

Pelles C => General discussions => Topic started by: Kochise on April 18, 2013, 04:26:00 PM

Title: char* != &char[0] ?
Post by: Kochise on April 18, 2013, 04:26:00 PM
PellesC hangs on this :

unsigned char *pointer;
unsigned char array[20];
pointer = &array[];

error #2140: "expected 'unsigned char *' but found 'unsigned char (*)[]'."

Kochise
Title: Re: char* != &char[0] ?
Post by: TimoVJL on April 18, 2013, 05:05:10 PM
use
Code: [Select]
pointer = &array[0];or
Code: [Select]
pointer = array;
Title: Re: char* != &char[0] ?
Post by: Kochise on April 18, 2013, 05:16:31 PM
Tried the first (&array[0]) with no luck.

Will try the second. Visual C++ 6 and Express 2008/2010 are just fine with the first. I just wanted to add PellesC compatibility, but it seams to be very delicate upon syntax.

Kochise
Title: Re: char* != &char[0] ?
Post by: TimoVJL on April 18, 2013, 05:34:26 PM
Tried the first (&array[0]) with no luck.
In my tests (v5 v7), this works:
Code: [Select]
int main(int argc, char **argv)
{
unsigned char *pointer;
unsigned char array[20];
//pointer = &array[];
pointer = &array[0];
pointer = array;
return 0;
}