Please TELL ME THAT WHAT IS ++ SIGN FOR IN 5++ AND ++5 or. In 5-- and--5 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please TELL ME THAT WHAT IS ++ SIGN FOR IN 5++ AND ++5 or. In 5-- and--5

Please tell me I am not understanding

7th Feb 2017, 1:54 PM
Mukul Kumar
Mukul Kumar - avatar
14 Answers
+ 11
This is a very good question. There is no difference if they are used by themselves. Take this: int x = ++5; The output of this code is 6. It says that x is equal to 1 more than 5. What about this: int x = 5++; The value of x is still 5. Why? This says to set the variable x to 5, and then increment the value. So x ends up as 5. Hope this helps! •_•
7th Feb 2017, 2:03 PM
Caleb Jore
Caleb Jore - avatar
+ 8
Yeah, It can be hard when you're new. I struggled with this a lot when I was new.
7th Feb 2017, 2:14 PM
Caleb Jore
Caleb Jore - avatar
+ 7
5 += ++6 5 += 7 5 = 5 + 7 12
7th Feb 2017, 2:07 PM
Caleb Jore
Caleb Jore - avatar
+ 7
@Mukul You're Welcome!
7th Feb 2017, 2:09 PM
Caleb Jore
Caleb Jore - avatar
+ 5
++ means you add 1 to the value in front/behind of it, -- does the opposite. Example: int x = 5; x--; //x Will become 4 x++; //x will become 5 again
7th Feb 2017, 2:02 PM
Jeroen
Jeroen - avatar
+ 5
Okay, here is an example for your next question: int x = 5; x += 5; //x Will become 10. Why? x += 5 actually means x = x + 5 --> x = 5 + 5 = 10. It's some sort of 'shortcut'.
7th Feb 2017, 2:07 PM
Jeroen
Jeroen - avatar
+ 4
This is most asked question on this site. Just use 'search' function provided here
7th Feb 2017, 2:02 PM
Jakub Stasiak
Jakub Stasiak - avatar
+ 1
thanks a lot friends
7th Feb 2017, 2:08 PM
Mukul Kumar
Mukul Kumar - avatar
+ 1
I am new to this
7th Feb 2017, 2:13 PM
Mukul Kumar
Mukul Kumar - avatar
+ 1
5+=6++ means 5+=6 5=5+6 11
7th Feb 2017, 4:29 PM
Sahana S Shenoy
+ 1
nice doubt.... these questions are comes from increment and decrement... ++5 means first increase by 1 then answers is 6. --5 first decrease by 1 then answers is 4.
9th Feb 2017, 5:01 PM
vikas singh
vikas singh - avatar
0
please also tell me that wat is this for 5+=6++
7th Feb 2017, 2:04 PM
Mukul Kumar
Mukul Kumar - avatar
0
can any one please help me with this problem?i have studied all the concepts in c and c++, almost all the concepts but when a program,slightly difficult program is asked i dont know how to implement this concepts and where to implement it? please give me a solution.
7th Feb 2017, 5:47 PM
rishabh
rishabh - avatar
0
this is post and pre increment operation
8th Feb 2017, 5:23 AM
Vivian Mascarenhas
Vivian Mascarenhas - avatar