Question with "extern" in C
- by why
When programming, I would like to split one large file(which contains main function) to many small files, so there is one common case: functions in small files can modify the var from main file, so i think extern is very useful!
for instance:
in main.c
extern int i = 100;
in small.c
extern int i;
fprintf(stdout, "var from main file: %d\n", i);
I just want to know is my understanding right?