Illustrates declaring external variables. - C Function

C examples for Function:Global Variable

Description

Illustrates declaring external variables.

Demo Code

#include <stdio.h>

int x = 9;/*from w w w  .ja v a  2  s  . co m*/

void print_value(void);

int main( void ){
    extern int x;

    printf("%d\n", x);
    print_value();

    return 0;
}

void print_value(void){
    extern int x;
    printf("%d\n", x);
}

Related Tutorials