static.h:
static.c:Code:static int t = 4;
static2.cCode:#include <stdio.h> #include <stdlib.h> #include "static.h" /*int t=7; Does not work */ int main(void) { printf("%i\n", t); return 0; }
Shouldn't there be an error when compiling like this:Code:int t=6;
Because there should be conflicts with the 2 t integers.Code:gcc static.c static2.c
The output is 4