Nearby lessons

14 of 72

C - Escape Sequences

Escape Sequences is one of the foundational topics in C programming. This lesson explains Common Escape Sequences and Program: escape sequences in action with complete, runnable code examples, clear step-by-step explanations, and common mistakes to avoid with exam-style MCQs at the end.

Common Escape Sequences

EscapeMeaning
\nNew line — move to the next line
\tTab — move to the next tab stop
\bBackspace
\"Print a double quote
\\Print a backslash
%%Print a percent sign
In simple words: an escape sequence is a secret code inside the quotes that starts with \ — \n means new line, \t means tab. The code is not printed; its effect is.

Program: escape sequences in action

Example02
Loading editor…
📝 Key Takeaways
  • printf() outputs; scanf() inputs (from stdio.h).
  • Format specifiers: %d int, %f float, %.2f two decimals, %c char, %s string.
  • Escape sequences: \n new line, \t tab, \\ backslash, %% percent.
  • scanf needs & before variables (except strings).
  • getchar()/putchar() handle one character.
  • getch/getche are Windows-only; prefer standard getchar.

🧠 Test Your Knowledge

2 Questions
Progress: 0 / 2

Finished this lesson?

Mark it as complete to track your progress and see technology completion stats.