+ 1
Explain answer plz?
C challenge question. https://code.sololearn.com/cRD6G38nJAJF/?ref=app
2 Respostas
+ 2
●So its related to global variable and local variable.
●So when int i is declared in f() it is different from global i=10 initialized at first.so as function call ends local i dies.
●but in g() i is reassigned 9 without declaring.so the compiler presumes it as global i.hence, the global i is now 9.
Am i correct?
0
You are correct!
Notice, too, that you get a warning on unused variable i in f(), but not in other places.