From the course: C: Data Structures, Pointers, and File Systems
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Reviewing printf() placeholders - C Tutorial
From the course: C: Data Structures, Pointers, and File Systems
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Using single character I/O4m 4s
-
Testing characters2m 34s
-
Working with character conversions2m 17s
-
Understanding strings in C3m 3s
-
Fetching string input3m 18s
-
Sending string output2m 46s
-
Reviewing printf() placeholders3m 8s
-
Using printf() placeholders3m 36s
-
Exploring string functions3m 29s
-
Manipulating strings3m 53s
-
Avoiding string problems2m 27s
-
Challenge: String I/O and manipulation1m 46s
-
Solution: String I/O and manipulation2m 16s
-
-
-
-
-