Mail Archives: djgpp/1998/01/15/12:14:54
On 15 Jan 1998, HackerOC3 wrote:
> printf("y value?");
> int y;
> scanf(" %d", &y);
> printf("color value?");
> int c;
> scanf(" %d", &c);
>
> In above code, i get parse errors before int. I also sometimes get parse
> errors in function prototypes for seemingly invaild reasons. Please help!!
You are obviously assuming that this code will be compiled as C++ (it is
illegal in C to put declarations such as "int y;" after executable
statements). But GCC compiles *.c files as C, not C++, so you get burned.
You need to rename your source file to have a .cc extension, then it will
work.
- Raw text -