Hello!
in a case where int a=5;
if((!a)++) or (++(!a)) gives me an error message saying that the operator ++ requires l-value, but the boolian result of if (!a++) is false.
If someone would be so kind to explain this!
zprise 0 Newbie Poster
Recommended Answers
Jump to Post!a returns a boolean value which can not be incremented.
Jump to PostI still didn't get it.
What exactly happens when the compiler meets if ((!a)++).
why doesn't forward !a by 1 and the result will be true.
a++
meana = a + 1
.
so(!a)++
mean!a = !a + 1
which!a
is not a variable.
Jump to Postmaybe you mean
if( !(++a) )
, which increments the value of a then checks if the value of a is 0.
All 9 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
zprise 0 Newbie Poster
invisal 381 Search and Destroy
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
zprise 0 Newbie Poster
zprise 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
zprise 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
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.