- 1
{int a=1; printf("%d",++a); func(); printf("%d",++a); return 0;} void func(){int a=10; return 1;}
Why is output 23??
2 Answers
+ 2
The function works on a copy of a, not the actual a from main.
Does it make more sense now?
+ 1
Your 'void func()' is playing no role in the code in your main(). How come a void function return something?
It is just the 'a' in main() printed twice after incrementing each time.