Skip to content

Commit

Permalink
added array to glob var
Browse files Browse the repository at this point in the history
  • Loading branch information
adithyaanilkumar committed Jun 29, 2020
1 parent e60eaa3 commit b39bf20
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions C/global_var.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//global variable example

#include <stdio.h>

int fun1(void);
int fun2(void);
int fun3(void);

int x ; /* global */

void 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 */
}

0 comments on commit b39bf20

Please sign in to comment.