+ 1
b++ or a++
can someone explain to me how to answer if we meet questions like that(b++ or a++)
6 Answers
+ 2
I think 2
+ 1
what the difference between a++ and ++a?
++a : it means increments then asign the value
ex:
int a=3;
int y=++a;
now y = 4 and also a=4
a++ : it means asign then increment the value
ex:
int a=3;
int y=a++;
now y=3 and a=4
+ 1
whatever the a and b values...it will be compiled logically...and the output is 1 or 0...
note: a true state is when the variable is not zero..
0
a++ means a=a+1 ,what do you think 2 or 3?
0
B++ = B+1
But if you are doing:
B=1
C= B++
B will be equal to 2 but C will be equal to 1.
As if you are doing :
1) B=1
2) C=B
3) B = B+1
- 2
Try to be more specific. a++ in general means that the program should increase value of a by one.