This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

extern declaration



Hi All,
 I have a small question about extern declaration,
which I found it strange.


test.c

int a[10][10]

/* some code */

test1.c

extern int **a;

int main ()
{
    int i = a[1][2];  // Problem here.

     return 0;

}

So, when I compile gcc -o test test.c test1.c
It compiles properly.When I run test it crashes.
After some time I realized that a is becoming NULL.

  How is it happening ? And the linker resolved the
symbol. So it should bind to the proper addreess.


 And one more, why are we not accepting some thing
like
 /*declarations */

char a[];  /* want to declare *a* as pointer to char
*/

But the function formal parameter list accepts this. 
Any specific reason ?

any explanations would be highly appreciated,

 Thanks and regards,

Thomas joseph
























Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]