logo

How to evaluate multiple increments in the same line? (++a + a++ - ++a)

#include <stdio.h> #include <string.h> int main(int argc, char* argv[]) { int a = 0; printf("%d\n", ++a + ++a - ++a + a++); // 1 + 2 - 3 + 3 = 3 // 4 + 3 - 2 + 0 = 5 return 0; }

Courses with this lesson