Utilizor
Contact Us

CC Output

Printing text.

C Output (Print Text)

The printf() function is used to output values/print text:

You can add as many printf() functions as you want. However, note that it does not insert a new line at the end of the output:

New Lines

To insert a new line, you can use the \n character:

Examples

Print Text

c example

Printing text without new lines.

#include <stdio.h>

int main() {
  printf("Hello World!");
  printf("I am learning C.");
  return 0;
}

New Lines

c example

Using \n to create new lines.

#include <stdio.h>

int main() {
  printf("Hello World!\n");
  printf("I am learning C.");
  return 0;
}

Multiple New Lines

c example

Creating blank lines.

#include <stdio.h>

int main() {
  printf("Hello World!\n\n");
  printf("I am learning C.");
  return 0;
}

Escape Sequence \t

c example

Creates a tab.

#include <stdio.h>

int main() {
  printf("Hello\tWorld!");
  return 0;
}

Escape Sequence \"

c example

Inserts a double quote.

#include <stdio.h>

int main() {
  printf("They call him \"Johnny\".");
  return 0;
}

Test Your Knowledge

1. Which function is used to print text in C?

2. How do you insert a new line?