0
Help me guys
whats the difference between ++x and x++
4 Answers
+ 4
int a = 2;
int b = ++a; // this will give b the value of 3 and a will be 3 too
int b = a++; // this will give b the value of 2 and then increment a so it will be 3
+ 3
Help yourself first,LoL
0
help me giys i need help
0
++x: x will be increased by 1 BEFORE performing this line of code;
x++: x will become x+1 AFTER running this line of code.
Example:
int x=1;
int y;
y=x++;
cout<<x<<" "<<y<<endl;
y=++x;
cout<<x<<" "<<y<<endl;
//the first line of output will be 2 1
//the second line will be 3 3