how come this compiles

Hi all;
i feel i am a little unfamiliar with this,please see the code:
1
2
3
4
5
6
7
8
#include <stdio.h>
int myInt ;
int myInt;  //is it a redefinition error,help.....
int main(int argc, char *argv[])
{
	printf("Hello C-Free!\n");
	return 0;
}


and the output is fine:
Hello C-Free!

or just click this link:http://codepad.org/G5RcCJNn

isn't there a redifinition error on variable myInt ?

Thanks in advance !
Last edited on
You must be compiling in C, not C++. In C, that's not a definition, just a declaration, so there can be any number of them.
yes,i do. thank you.Now i have to review the difference between declaration and definition in c .
Topic archived. No new replies allowed.