Link to home
Start Free TrialLog in
Avatar of Stephen Kairys
Stephen KairysFlag for United States of America

asked on

Is there such a thing as an %i format specifier in C?

Hello.
Someone E-mailed me some information about C format specifiers, and in it, referreed to the
%hd and %hi format specifiers (the "h" specifing a short 16-bit int).

%hd makes sense to me as a "cousin" of %d, but "%hi" does not, since I'm not sure that there
is such a thing as %i. %hu (for unsigned) would seem more logical.  I've programmed in C for
about four years and have always used %d and %u.

Please advise.
Thanks
stevefromc
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

I use to use %i specifier most of the time, it refers to a unsigned integer, and yes, it is a standard C specifier.
Avatar of Stephen Kairys

ASKER

Is it the same as %u? If not, what is the difference? Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Cool. That  clarifies it. Thanks so much :)
One more thing: I split your points since your last two posts both contained helpful info. Thanks again!
If both answers are totally clear, why the B grade?
B grade is suggested for semi-satisfactory answers.
I think I have fully answered your question, including theory links.
Valid point. Guess I wasn't thinking. I'll post on Community Support for a grade change.
Thank you man, I preciate it. See you in next question.
Jaime.
Avatar of RomMod
RomMod

The grade has been changed to A as requested.

RomMod
Community Support Moderator