Complie error

Write here if you have problems with your C source code

Moderator: Board moderators

Post Reply
kantaki
New poster
Posts: 10
Joined: Tue May 29, 2007 6:18 pm

Complie error

Post 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?
mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post 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.
kantaki
New poster
Posts: 10
Joined: Tue May 29, 2007 6:18 pm

Post 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++.
Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post 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.
For millions of years, mankind lived just like the animals. Then something happened which unleashed the power of our imagination. We learned to talk and we learned to listen...
chunyi81
A great helper
Posts: 293
Joined: Sat Jun 21, 2003 4:19 am
Location: Singapore

Post 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.
Post Reply

Return to “C”