C TutorialLesson 5Free preview
C Output
This lesson is part of C · All levels
Summary
Output in C is performed with the printf function of the stdio.h header, which displays text or value to the screen (stdout). You can print plain text, numbers in %d format, decimal numbers %f, or characters %c. The sequence of values given after the string format must correspond to the type and number of specifiers in it. To print the percentage mark itself, write %% because % is used as a prefix for the format.
Key points
- Printf() displays output to the screen without adding an automatic newline
- Common specifier format: %d (int), %f (float), %c (char), %s (string)
- The number and order of arguments after the string format must match the specifier
- Use \n at the end of the output to move the line
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.