Lazar Lazar - 1 year ago 131
C Question

Functions and variables scope in C

Why we don't use extern when using function from one .c file in another .c file , but we must do extern for variables case? Is it related to linker?

Answer Source

Functions are extern qualified by default (unless you change it to internal with static). For example,

int func(void) {

extern int func2(void) {

Both func and func2 are external. The extern keyword is optional for external functions.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download