1st 2 time a value is increment then return, but why show output 23? Any tricks inside here? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

1st 2 time a value is increment then return, but why show output 23? Any tricks inside here?

Int main(){ Int a=1; Printf("%d",++a); Func(); Printf("%d",++a); Return 0; } Void main(){ Int a= 10; Return 1; }

23rd Aug 2020, 4:04 PM
Suparna Podder
Suparna Podder - avatar
1 Answer
+ 1
Your code have errors lot.. Look again.. First printf prints ++a value which is 2,and now a = 2 Next printf prints in same way as 3, now a = 3 so output is 23. May you mean corrected code is : 1st 2 time a value is increment then return, but why show output 23? Any tricks inside here? int main(){ int a=1; Printf("%d",++a); Func(); printf("%d",++a); return 0; } void Func(){ intt a= 10; } This function Func has no effect on code..
23rd Aug 2020, 4:18 PM
Jayakrishna 🇮🇳