Using a global and duplicate variable in main - C Function

C examples for Function:Global Variable

Description

Using a global and duplicate variable in main

Demo Code

#include <stdio.h>

int var = 99;//  ww w .  ja  v a 2 s  .c  o  m

void print_func(void);

int main( void )
{
    int var = 77;
    printf( "\nThe Value of var is %d", var );
    print_func( );

    return 0;
}
void print_func( void )
{
    printf( "\nPrinting in function  only global:");
    printf( "\nThe value of var is %d\n", var );
}

Related Tutorials