What is difference between ++x and x++ ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is difference between ++x and x++ ?

25th Dec 2015, 3:14 PM
Jagdeep Singh
8 Answers
+ 2
if x=5 and x++ still 5, what is the reason using x++
24th Jun 2016, 4:58 AM
Niyazi Alpay
Niyazi Alpay - avatar
+ 1
++x is the value of x is first incremented and then its is assigned to the variable and x++ means first the value is assigned to the variable and then its incremented
3rd Jul 2016, 6:25 AM
Avinash Bhuma
Avinash Bhuma - avatar
0
++x is pre increment and x++is post increment order
10th Jan 2016, 12:35 PM
MAHESH TRIBHUVAN CHAUBEY
MAHESH  TRIBHUVAN CHAUBEY - avatar
0
++x means increment the value of x to be used in that statement, while x++ means use the original value of x in that statement, and increment the value of x afterwards.
13th Jan 2016, 9:26 AM
Hui Rong
Hui Rong - avatar
0
in ++x a value of x is increas and store in x. in x++ a value of x is only increase but not store on that line of programme after use x in on other line in programme that's increased value is store
30th Jan 2016, 7:03 AM
Manan Desai
Manan Desai - avatar
0
say x=5; post increment: x++; here value of x is still 5. pre increment: ++x; here value of x is 6.
31st Jan 2016, 5:35 PM
Ananda Gajapathi raju
Ananda Gajapathi raju - avatar
0
in that statement, x = to what it always was. After that statement, x = ++x. in other words, it uses the original value and then increases it after it has been used in that statement.
8th Jul 2016, 10:05 AM
James Demaine
James Demaine - avatar
0
no difference
18th Aug 2016, 4:46 PM
Suraj Vishwakarma
Suraj Vishwakarma - avatar