- 1
X = 5; x=x++ *2+3* --x;
3 Antworten
+ 2
shivam sandhan
Here x++ is post increment which first assign value then increment counter.
--x is post decrement which first decrement value by 1 then assign.
So here
x = x++ * 2 + 3 * --x;
Here x++ will assign value then x will be increased by 1 so x will be 6
x = 5 * 2 + 3 * --x;
As x was 6 so --x will be 5
So now
x = 5 * 2 + 3 * 5 = 25
+ 1
Welcome to SoloLearn forum! your thread appears to be spam in nature.
Your thread will be reviewed by the moderation team and most likely will be marked for deletion.
Here are some tips to make sure your question qualifies:
- Post only programming-related QUESTIONS and ANSWERS;
- SEARCH for similar QUESTIONS or ANSWERS before posting;
- Include relevant TAGS;
- Follow community RULES: https://www.sololearn.com/Content-Creation-Guidelines/
DO NOT
- Post spam/advertisement;
- Use inappropriate language.
* Post general discussions and open-ended questions in your feed.
https://www.sololearn.com/discuss/1316935/?ref=app
0
That's undefined behavior, the result depends on the compiler