I read the documentation and it says that a long is %li but the print out comes back as -2147024891. What gives?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You didn’t even provide which number you wanted to print, but I guess you’ve stumbled over the difference between signed and unsigned printing.
Use
%luforunsigned longnumbers, and%ldor%liforsigned longnumbers.The MSDN has good documentation on printf specifiers. For 64-bit values (like
long long, for example), you should use the macros in<inttypes.h>.