function calls before variable declarations does not give error in gcc?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

The following code does not give an error wth gcc

void fun(int a){ printf("there u go %d\n",a);}

int main()
{
        char abc[10] = "the";
        int a1 = 10;
        fun(10);
        int a = 1;
} 

gcc --version gave the following o/p:

gcc (GCC) 3.3.1 (SuSE Linux)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

while wth a compiler that gave the following o/p wth gcc --version
2.96

I got the following error:
test1.c: In function `main':
test1.c:10: parse error before `int'

why this difference?

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux