H
himadri
Hi Everybody,
Please have a look at the code snippet below ----
#include <stdio.h>
int a;
int a;
int main()
{
printf(" a = %d\n", a);
return 0;
}
At first I thought as "a" is defined twice, so it should give
compilation error. But to my surprise it compiled and ran sucessfully
with output " a = 0 ". I checked with the following compilers ---
MingW gcc 3.4.2
Borland C++ 5.5
MS VC++ 6
MS VC++ 8
with ansi switch enabled. Please help me in clarifying my doubt. Can
somebody please quote the relevant section from the ANSI std( or for
that matter ISO C90 std )?
Regards
himadri
Please have a look at the code snippet below ----
#include <stdio.h>
int a;
int a;
int main()
{
printf(" a = %d\n", a);
return 0;
}
At first I thought as "a" is defined twice, so it should give
compilation error. But to my surprise it compiled and ran sucessfully
with output " a = 0 ". I checked with the following compilers ---
MingW gcc 3.4.2
Borland C++ 5.5
MS VC++ 6
MS VC++ 8
with ansi switch enabled. Please help me in clarifying my doubt. Can
somebody please quote the relevant section from the ANSI std( or for
that matter ISO C90 std )?
Regards
himadri