Can u anybody of u explain me how the following statement works??
y=x++<=5;:!:
himanjim 0 Junior Poster in Training
Recommended Answers
Jump to PostIf x is less than or equal to 5, y is set to 1 -- otherwise y is set to 0; x is then incremented.
But better would be for you to ask, "I think that this statement does [...]. Is this correct?" Or at least provide a (minimal, …
Jump to PostIs x incremented before or after the result of the comparison is assigned to y?
After.
Correct me if I am wrong in the explaination below.
y=x++<=5;
is equivalent toy=(x++<=5);
.
The part inside the brackets should be evaluated first. So doesn't that mean the binary comparison and the …
Jump to PostI know that it is done after the comparison. I wanted to know if it was done after or before the assignment.
I'll go out on a limb a little (and search more later) and say that it is done after the comparison and before the assignment.
All 13 Replies
Dave Sinkula 2,398 long time no c Team Colleague
WolfPack 491 Posting Virtuoso Team Colleague
Dave Sinkula 2,398 long time no c Team Colleague
WolfPack 491 Posting Virtuoso Team Colleague
Dave Sinkula 2,398 long time no c Team Colleague
himanjim 0 Junior Poster in Training
WolfPack 491 Posting Virtuoso Team Colleague
himanjim 0 Junior Poster in Training
Dave Sinkula 2,398 long time no c Team Colleague
WolfPack 491 Posting Virtuoso Team Colleague
Dave Sinkula 2,398 long time no c Team Colleague
WolfPack 491 Posting Virtuoso Team Colleague
Dave Sinkula 2,398 long time no c Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.