Saturday, May 22, 2010

Why does Dev C++ give me this compiler error?

#include %26lt;stdio.h%26gt;





int main()


{


printf("Here");


char something[5];


return 0;


}





Error:line 6


parse error before `char'

Why does Dev C++ give me this compiler error?
if this is a .c file, then the reason is that you have declared local variables AFTER a function call. This is legal in c++ but not in c.





swap the printf and char lines and it should work.


No comments:

Post a Comment