Answers for "how does ++operator works in c++"

C++
-1

how does ++operator works in c++

#include <stdio.h>
int main() {
   int var1 = 5, var2 = 5;

   // 5 is displayed
   // Then, var1 is increased to 6.
   printf("%d\n", var1++);

   // var2 is increased to 6 
   // Then, it is displayed.
   printf("%d\n", ++var2);

   return 0;
}
Posted by: Guest on May-10-2021

Browse Popular Code Answers by Language