课程: Complete Guide to C Programming Foundations

今天就学习课程吧!

今天就开通帐号,24,100 门业界名师课程任您挑!

Exploring the printf() function

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…

内容