From the course: C Standard Library

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Formatted I/O

Formatted I/O - C Tutorial

From the course: C Standard Library

Start my 1-month free trial

Formatted I/O

These functions also work on files and character streams. Some of them even work on strings. Again, the term formatted means string encoding. So for example, the value 65 will yield the capital capital A if encoded as a character, or the string 65 if encoded as decimal, or even the string 41 if encoded as hexadecimal. You may already know some of these functions which belong to the iconic family of printf, scanf, and sprintf. We'll talk about three functions. Scanf, which reads characters from std in, printf, which writes characters into std out, but writes the resulting string to memory for later use. Now notice how all of the parameter lists in these definitions, and with ellipses. This syntax is used to indicate that this is a so called variadic function. Meaning that the function will take in a variable number of arguments. The reason for this is that the format argument is supposed to contain formatting symbols that indicate how to convert the variable's value into the target…

Contents