output of the following program. why?

a.c
---
 
int a;

b.c
---

int a = 10;
main.c
------

1
2
3
4
5
6
extern int a;
int main()
{
        printf("a = %d\n",a);
        return 0;
}


output is :
a = 10

why linking error is not there as 'a' is defined multiple times in a.c and b.c?
You are using c?
Topic archived. No new replies allowed.