Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » BeginnersRSS Feeds

ILLUSTRATION OF PROPERTIES OF GLOBAL VARIABLES

Posted By: Corey Brown     Category: C Programming     Views: 2111

ILLUSTRATION OF PROPERTIES OF GLOBAL VARIABLES.

Code for ILLUSTRATION OF PROPERTIES OF GLOBAL VARIABLES in C Programming

int fun1(void);
   int fun2(void);
   int fun3(void);                                                        
   int x ;            /* global */
main( ) { x = 10 ; /* global x */
printf("x = %d\n", x); printf("x = %d\n", fun1()); printf("x = %d\n", fun2()); printf("x = %d\n", fun3()); } fun1(void) { x = x + 10 ; } int fun2(void) { int x ; /* local */
x = 1 ; return (x); } fun3(void) { x = x + 10 ; /* global x */
} Output x = 10 x = 20 x = 1 x = 30
  
Share: 


Didn't find what you were looking for? Find more on ILLUSTRATION OF PROPERTIES OF GLOBAL VARIABLES Or get search suggestion and latest updates.

Corey Brown
Corey Brown author of ILLUSTRATION OF PROPERTIES OF GLOBAL VARIABLES is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!