Page 1 of 1

Complie error

Posted: Sat Jun 09, 2007 1:08 pm
by kantaki

Code: Select all

typedef struct _list {
	int stacknum;
	int stackseq;
} LIST;
LIST data[25];

This code is compile error in C.
But it is not compile error in C++.

I wrote code by C. and submit with C, I got compile error.
But C++ is Accept.

What make me compile error in C?

Posted: Sat Jun 09, 2007 1:18 pm
by mf
This code compiles:

Code: Select all

typedef struct _list {
   int stacknum;
   int stackseq;
} LIST;
LIST data[25];

int main() { return 0; }
Search for errors in another place of your code.

Posted: Sat Jun 09, 2007 1:57 pm
by kantaki
Thanks mf.
You're right.
Even though, I got Compile error :(
I give up this problem.

I'll satisfied with Accept in C++.

Posted: Sat Jun 09, 2007 3:50 pm
by Krzysztof Duleba
I can't tell you what the problem really is unless you provide the exact error message (you should get in on your email). However, one thing is that all identifiers beginning with underscore are reserved for internal purposes and one must avoid using them. Suggested approach is to use trailing underscores instead.

Posted: Sun Jun 10, 2007 4:58 pm
by chunyi81
One possible reason could be the use of C++ style comments in C code -

Code: Select all

// comment
Usually, this should compile with gcc but the judge's version of gcc won't compile this.