CJCoding With Joseph
15free / daySign inCreate account

Mastering C Textbook

Variables & Print Statements

A print statement is used to display text to your console.

printf("Hello World!");

OUTPUT:

Hello World!


New Line

\n will move your text to the next line.

printf("Hello\nWorld!");

OUTPUT:

Hello
World!

 

Tabs

\t will tab your text (usually adds 4 spaces).

printf("Hello\tWorld!");

OUTPUT:

Hello    World!

 

Chars

A char is used to store a single character. Using %c inside of a print statement, you can display the char value. Chars must use single quotes ''. Double quotes "" will result in an error.

Members only

Keep reading this lesson

You've reached the end of the free preview. Unlock the rest of this lesson plus 11 more lessons in Mastering C Textbook.

  • Unlimited coding questions
  • Unlimited access to all classroom material
  • Weekly live call for questions and guidance
  • 3,000 AI tutor tokens / month
  • Personal SQL database (3 MB)
  • Progress tracking

Cancel any time.