0.c
extern int num;
int main(){
return num;
}
1.c
int num;
2.c
int num = 5;
Above compiles fine with gcc 0.c 1.c 2.c. Why don't I get a multiple definition error during linking?
Isn't int num; under 1.c a full definition?:
tentative definition becomes a full definition if the end of the translation unit is reached and no definition has appeared with an initializer for the identifier.
Or is this undefined behaviour?