C code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C code

https://code.sololearn.com/c4a88vG1plL0/#c Can anyone explain me how the output comes??

14th Nov 2018, 5:14 AM
Dhiviya Thirumavalavan
Dhiviya Thirumavalavan - avatar
2 Answers
+ 3
Val++ has increment the value from 10 to 11 thats why when function call made it uses value 11 and return 11*11*11 which is 1331
14th Nov 2018, 5:22 AM
MsJ
MsJ - avatar
+ 3
Having a global variable like this puts you into trouble if there was another variable named `val` somewhere in the main like so int val = 20; val=10; funct(); val++; printf("%d",funct());
14th Nov 2018, 6:16 AM
Babak
Babak - avatar