From the course: C: Data Structures, Pointers, and File Systems

Unlock the full course today

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

Reviewing printf() placeholders

Reviewing printf() placeholders - C Tutorial

From the course: C: Data Structures, Pointers, and File Systems

Start my 1-month free trial

Reviewing printf() placeholders

- [Instructor] The first argument in the printf function is a formatting string. It contains standard characters to output but also conversion specifications, which are commonly called placeholders. These placeholders represent additional arguments in the function, which are converted to text and inserted into the format string for output. Conversion specifications are prefixed by the percent character. This character is followed by optional characters to set output width, justification, and other formatting details. The conversion character comes last. It's related to its companion argument's data type. For each conversion character, an argument must be available in the printf function. If not, the compiler issues a warning. A warning may also be issued when the placeholder doesn't match the argument's data type. Here's a list of common conversion characters, though your compiler may feature more. For example, percent d generates decimal output for an integer. Percent f generates…

Contents