From: "Steve Dondley" <s@dondley.com>
To: <gcc-help@gcc.gnu.org>
Subject: printf format specifiers
Date: Sun, 20 Oct 2002 05:52:00 -0000 [thread overview]
Message-ID: <FAECKOGIHAIBBPKBOKGNIEFADOAA.s@dondley.com> (raw)
Hi,
I have the following line in one of my programs:
printf("%d\n", *string);
*string is a pointer to a string. The above line prints out the ASCII
decimal equivalent of the character that the pointer is pointing to. This
is what I was looking to accomplish.
My question is why? Why wouldn't I need to use the %hu (unsigned short
integer) format specifier? When I do use the %hu, I get precisely the same
results. This despite the fact that %d reads an entire word and %hu reads a
single byte.
Is this some compiler magic going on here?
Thanks.
next reply other threads:[~2002-10-20 12:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-20 5:52 Steve Dondley [this message]
2002-10-20 7:14 ` Der Herr Hofrat
2002-10-21 6:33 ` John Love-Jensen
2002-10-23 18:38 ` Segher Boessenkool
2002-10-23 19:01 ` Roberto Díaz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=FAECKOGIHAIBBPKBOKGNIEFADOAA.s@dondley.com \
--to=s@dondley.com \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).