E() called two time. Each time value of a and b is different. Why? Explain in detail please. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

E() called two time. Each time value of a and b is different. Why? Explain in detail please.

#include <stdio.h> int a=10,b=20; int main() { int a=5,b=6; C(); a=2,b=3; E(); printf("\n%d %d",a,b); return 0; } C() { int a=23; printf("\n%d %d",a,b); D(); a=6; } D() { int b=44; E(); printf("\n%d %d",a,b); } E(){ printf("\n%d %d",a,b); a=1,b=2; }

27th Jul 2019, 5:25 PM
Sagar Singh Khati
Sagar Singh Khati - avatar
2 Answers
+ 4
E use a and b of the global scope, so the first time they have 10 and 20 as their values, then they have 1 and 2 as E set them so that they have those values
27th Jul 2019, 7:11 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
Thnk you...
28th Jul 2019, 1:14 AM
Sagar Singh Khati
Sagar Singh Khati - avatar