From the course: Complete Guide to C Programming Foundations
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Exploring the printf() function - C Tutorial
From the course: Complete Guide to C Programming Foundations
Exploring the printf() function
- [Instructor] The C language most likely spawned the printf function, which is used in many other programming languages. This function generates formatted output. Its first or only argument is a formatting string as shown in this exercise file. This text is output. Unlike the puts function, a new line isn't added to this text automatically. The new line escape character here does the job. And there's the text. The power in the printf function lies in the placeholders or conversion specifications found in the formatting string. Here you see the percent D placeholder, corresponding to it is an additional argument, integer variable A. These data types must match, percent D for decimal integer, and integer variable A. Here is the formatted output. This code's printf statement has three placeholders in its formatting string, percent C for character variable CH, percent U for unsigned integer variable X and percent F for floating point value pi. Most editors color code the placeholders…
Contents
-
-
-
-
Understanding C language data types3m 17s
-
(Locked)
Declaring variables2m 53s
-
(Locked)
Working with variables3m 4s
-
(Locked)
Exploring the printf() function3m 48s
-
(Locked)
Using constants2m 58s
-
Challenge: Making variables and constants53s
-
(Locked)
Solution: Making variables and constants1m 16s
-
(Locked)
Understanding variable scope3m 35s
-
(Locked)
Making new data types3m 25s
-
(Locked)
Specifying characters and strings3m 17s
-
(Locked)
Specifying integers and real numbers3m 55s
-
(Locked)
Typecasting a variable2m 20s
-
(Locked)
Chapter challenge: Adding variables and constants1m 10s
-
(Locked)
Chapter solution: Adding variables and constants2m 7s
-
-
-
-
-
-
-
-
-
-