Answers for "what is the difference between --i and i-- in c++?"

C++
2

what is the difference between i++ and ++ i ?

i = 1;
 j = ++i;
 (i is 2, j is 2)
 //diference
 i = 1;
 j = i++;
 (i is 2, j is 1)
Posted by: Guest on July-04-2021
0

difference between --a and a-- c++

// The difference is here:

int a = 0;
int b = a++; // b = 0, a = 1 

// Where

int a = 0;
int b = ++a; // b = 1, a = 1
Posted by: Guest on July-29-2021

Code answers related to "what is the difference between --i and i-- in c++?"

Browse Popular Code Answers by Language