printf does what the format sting tells it to do:

by counting_pine (no login)

"%d" will take the input and always see it as a signed integer. In fact, you'll get the same result here if you take away the '-' sign.
Try doing a test in C++ with std::cout, and see what happens there.

Posted on Apr 7, 2008, 4:12 PM
from IP address 86.164.34.141

Respond to this message   

Return to Index


Response TitleAuthor and Date
With std::cout, it prints positiveqbguy on Apr 7
 gcc defaults to C89, and C++98 isn't any better regarding this aspect.rpgfan3233 on Apr 7