-   Programming (
-   -   Is this ansi-c compliant? (

xailer 12-26-2003 02:51 PM

Is this ansi-c compliant?

You can use pointer notation with an array in C:

int X[]={1,2,3};

int Y=*X[1];

But can you also use array notation with pointer(is it ansi c compliant)?

int i=3;

int *X=&i;

X[0]=10; //is this legal?

thank you


infamous41md 12-26-2003 03:43 PM

why dont you just compile with gcc and use -ansi and find out? :D

xailer 12-26-2003 06:26 PM

Is function:

int X(i)
int i;
int j=16;

ansi c compliant?No,it ain't.But still,using 'cc -ansi X.c' doesn't give me any warnings about it,so I don't know why I should rely on -ansi switch to tell me whether something is ansi c or not

chens_83 12-26-2003 08:00 PM

this is is an old style if i remember correctly

infamous41md 12-26-2003 08:48 PM

YES that is compliant and YES you can rely on gcc to tell you.

infamous41md 12-26-2003 08:49 PM

and "No, it ain't" isn't "grammatically compliant".

All times are GMT -5. The time now is 07:49 PM.