C++ Special Characters
β¨ C++ Special Characters (Escape Sequences)
C++ mein special characters (escape sequences) ka use new line, tab, quotes, backslash jaise formatting kaam ke liye hota hai.
Ye hamesha backslash \ se start hote hain.
πΉ 1. Common Special Characters List
| Escape | Meaning |
|---|---|
\n |
New line |
\t |
Horizontal tab |
\\ |
Backslash \ |
\" |
Double quote " |
\' |
Single quote ' |
\r |
Carriage return |
\b |
Backspace |
\f |
Form feed |
\v |
Vertical tab |
πΉ 2. New Line (\n)
Output:
πΉ 3. Tab Space (\t)
Output:
πΉ 4. Print Quotes in Output
Output:
πΉ 5. Print Backslash
Output:
πΉ 6. Single Quote Character
Output:
πΉ 7. Backspace (\b) Example
Output (conceptually):
πΉ 8. Carriage Return (\r)
π Cursor line ke start par aa jaata hai (behavior terminal par depend karta hai).
πΉ 9. Use in Strings & Characters
β Common Mistakes
β Correct:
π Summary
-
Special characters formatting ke liye hote hain
-
\n(new line) &\t(tab) most common -
Quotes/backslash print karne ke liye escape zaroori
-
Strings (
" ") aur chars (' ') dono mein use hote hain
