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

Exploring the printf() function - C Tutorial

From the course: C Essential Training

Start my 1-month free trial

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…

Contents