An example that uses extern. - C Function

C examples for Function:Global Variable

Introduction

The extern specifier tells the compiler that the variable types and names that follow it have been defined somewhere else.

File One                             File Two

int x, y;                            extern int x, y;
char ch;                             extern char ch;
int main(void)                       void func22(void)
 {                                    {
  /* . . . */                          x = y / 10;
 }                                    }

void func1(void)                     void func23(void)
 {                                    {
  x = 123;                            y = 10;
 }                                    }

Related Tutorials