From the course: C Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Exploring the printf() function - C Tutorial
From the course: C Essential Training
Exploring the printf() function
- [Instructor] It's most likely that the C language introduced the programming world to the printf function, it's immensely popular. This function generates a formatted output. Its argument is a format string as shown in this exercise file, and this text is output. Unlike the puts function, a new line isn't added automatically when this function outputs its text. So therefore the new line escape character appears at the end of this string. Build and run. Hello, world! The power in the printf function lies in its formatting string. Within this string, you can set placeholders, our conversion characters. For example, here, you see percent %d, which is the placeholder for another argument that must be added, variable a here, the data types must match. So %d is for decimal output of an integer value and variable a is an integer. Build and run. The value of a is 65. In this code, the printf statement at line nine…
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
-
-
-
-
Understanding C language data types3m 4s
-
(Locked)
Declaring variables2m 49s
-
(Locked)
Working with variables2m 55s
-
(Locked)
Exploring the printf() function3m 4s
-
(Locked)
Using constants2m 53s
-
(Locked)
Challenge: Make variables and constants47s
-
Solution: Make variables and constants1m
-
(Locked)
Understanding variable scope3m 8s
-
(Locked)
Making new data types3m 24s
-
(Locked)
Specifying characters and strings3m 17s
-
(Locked)
Specifying integers and real numbers4m 14s
-
(Locked)
Typecasting a variable3m 11s
-
(Locked)
Challenge: Basic I/O1m 10s
-
(Locked)
Solution: Basic I/O1m 35s
-
-
-
-
-