+ 3

Why the output is 22?Help with abstraction

#include <stdio.h> #include <stdlib.h> int main() { int a=0; printf("%d%d\n",++a,++a); return 0; }

13th Jun 2020, 5:41 AM
Coding San
Coding San - avatar
2 Answers
+ 2
this called undefined behaviour u modify the same variable more than once in one expressions we dont know how it behave or in what order it is evaluated there are other ways to achieve the same thing but this one is not recommended
13th Jun 2020, 5:50 AM
durian
durian - avatar
+ 1
So what are the other ways
13th Jun 2020, 11:15 AM
Coding San
Coding San - avatar