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

16th May 2021, 2:32 PM
Aradhyula Veera teja
Aradhyula Veera teja - avatar
1 Antwort
+ 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.
16th May 2021, 2:46 PM
Avinesh
Avinesh - avatar