2,251 views

2 Answers

1 1 vote

a,b,c are global variable a=0,b=0,c=0
main() assigns value to a=3,b=5,c=7.
it calls func1()
func1()

       it create local variable a=6,b=8,
       Calls func2()

func2()

       it create local variable b=4, c = a+b
       as func2() has no local variable named a, 
       global a is available to func2().

       c=3+4 = 7

       global a = 3+11 =14

       print(c)               ----------- 7

        return to func1()
 func1():

        a=a+b+c
        a,b are local and c is global
        a=6+8+7 = 21

        print(a)     local a          ----------- 21

retun to  main()

Position:
Show:

Related questions

0 0 votes
1 answers 1 answer
710
710 views
Parshu gate asked Nov 19, 2017
710 views
#include<stdio.h>int main(){ int a=2;if(a==2){ a=~a+2<<1; printf("%d",a);}}
0 0 votes
0 0 answers
1.9k
1.9k views
aimhigh asked Jan 8, 2019
1,909 views
#include<stdio.h>void main(){int p=-8;int i= (p++,++p);printf("%d\n",i);}
0 0 votes
0 0 answers
1.4k
1.4k views
Na462 asked Dec 8, 2018
1,353 views