Multiple declarations and definitions

Posted by Yogesh on Stack Overflow See other posts from Stack Overflow or by Yogesh
Published on 2010-05-26T09:55:39Z Indexed on 2010/05/26 10:11 UTC
Read the original article Hit count: 131

Filed under:

Content of X.c:

int i;
main ()
{
fun ();
}

Content of Y.c:

int i;
fun ()
{
}

Why does these two files compile with no error ? (using GCC)

But if i use int i = 10; it prints a multiple definition error.

© Stack Overflow or respective owner

Related posts about c