Lazar Lazar - 25 days ago 4x
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?


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.