C Language and Libraries Help (clang.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
scanf Type Characters
◄Up► ◄Contents► ◄Index► ◄Back►
─────Run-Time Library───────────────────────────────────────────────────────
The scanf type characters and their meanings are described below:
Character Type of Input Expected Type of Argument
d Decimal integer Pointer to int
o Octal integer Pointer to int
x, X Hexadecimal integer Pointer to int
i Decimal, hexadecimal, Pointer to int
or octal integer
u Unsigned decimal integer Pointer to unsigned int
e, E Floating-point value Pointer to float
f consisting of an optional
g, G sign (+ or -), a series of
one or more decimal digits
containing a decimal
point, and an optional
exponent ("e" or "E")
followed by an optionally
signed integer value
c Character. White-space Pointer to char
characters that are
ordinarily skipped are read
when c is specified; to read
the next non-white-space
character, use %1s.
s String Pointer to character
array large enough for
input field plus a
terminating null
character (\0),
which is automatically
appended
n No input read from stream Pointer to int, into
or buffer which is stored the
number of characters
successfully read from
the stream or buffer
up to that point in
the current call to
scanf
p Value in the form Pointer to far
xxxx:yyyy, where the pointer to void
digits <x> and <y> are
uppercase hexadecimal
digits
The D and U type characters that were previously used to read in
long ints and long unsigneds, respectively, are no longer
supported.
To store a string without storing a terminating null character
(\0), use the specification %nc, where <n> is a decimal integer.
In this case, the c type character indicates that the argument is
a pointer to a character array. The next <n> characters are read
from the input stream into the specified location, and no null
character (\0) is appended. If <n> is not specified, the default
value for it is 1.
-♦-