???????????????????????linux?3????window??δ???????????????????????????c??????

????C???????????????????c?????????????????????????????????????????????????????????????????????????????????λ??

?????????????????????

??????c?????У???????????????????????????δ??????????????????????????????????????????????????????????????????????????

??????????????????

?????????????????????????????????????

?????????????????????????????

???????????壺

?????????

//main.c
#include <stdio.h>
int fun();

int x;

int main()
{
 printf("in main.c:x=%p "?? &x);
 fun();
 return 0;
}
//test.c

#include <stdio.h>

int x;

int fun()
{
 printf("in test.c:x=%p "?? &x);
 return 0;
}

????????gcc main.c test.c?????У??????

????in main.c:x=0x80496a8
????in test.c:x=0x80496a8

????????x??????????????????????????????????????extern???

?????????

//main.c
#include <stdio.h>
int fun();

int x;

int main()
{
 printf("in main.c:&x=%p "?? &x);
 fun();
 return 0;
}

//test.c

#include <stdio.h>

struct
{
<SPAN style="WHITE-SPACE: pre"> </SPAN>char a;
<SPAN style="WHITE-SPACE: pre"> </SPAN>char b;
<SPAN style="WHITE-SPACE: pre"> </SPAN>char c;
<SPAN style="WHITE-SPACE: pre"> </SPAN>char d;<SPAN style="WHITE-SPACE: pre"> </SPAN>

<SPAN style="WHITE-SPACE: pre"> </SPAN>int t;