0
Why " j " is not incremented in the following c code? Any reference for auto keyword in c ?
main () { void fun () fun( ); fun( ); } void fun () { static inti = 1; auto intj = 5; printf ("%d", (i++); printf("%d",(j++); } The output of the code is :- 1525
1 Réponse
+ 1
It is because a static variable is declared once and retains it's value between function calls whereas the auto variable doesn't do the same and are re-declared everytime the function is called.