Hi all, what is the syntax error below? int myarray[2] = {10,20}; while it compiles ok if int is changed to char. Regards Dravid
"or you have not defined the 'int' type" Err... int is a standard 'C' type; in fact, it is the standard 'C' data type!
Or have #defined "int" (in which case you deserve what you get...) Context counts, too. Consider: long int myarray[2] = {10,20}; which will fail to compile if you change "int" to "char".
"Context counts, too." Very true - especially if there are other errors earlier in the file! Faulty macro expansions are also a very good way to mess-up the context - which is why I keep recommending that people read the preprocessor listing.
The error goes away if the initialisation is done in next statements. int myarray[2]; myarray[0]=10; myarray[1]=20;