Accessing Top-Level Variables from Other Files

Variables must always be declared before they are used.

The modifier extern used to indicate a top level variable is defined elsewhere in program. E.g:


/* a.c */
extern int count;

/* b.c */
extern int count;

/* c.c */
int count;

Index