Why the control goes in “else” part? [closed]

The code above always prints x. If your code prints something else, then you omitted vital information in your question.

To find out what that might be, try this:

  1. Insert #undef a before the int a = 8; to make sure there isn’t a C preprocessor macro that messes with the code.

  2. Swap the condition to see if a is really what you expect:

    if( 8 == a )
    

    This little trick also prevents you from the accidental assignment bug (if( a = 8 ))

Leave a Comment