C Escape Characters
C Escape Characters
In this tutorial, we will learn about C Escape characters. In the C language, a string is a sequence of characters enclosed between double quotes. Some characters in the string are limited. We use escape characters(escape sequences) to overcome this limitation.
C Escape Characters
The C language supports many escape sequences. The most common escape sequences are as follows:
C Escape Sequence | Description |
\n | New line. This will move the cursor to the new line |
\t | Tab space, This will print some spaces |
\” | To escape the double quote character |
\’ | To escape the single quote character |
\\ | To display backspace character |
\0 | Null. This is used to terminate character strings |
Example
/** ********************************** * Program Description: * C Escape Characters Demo * Filename: escape.c * C Tutorials - www.TestingDocs.com ************************************* */ #include int main() { printf("Name in quotes \"TestingDocs\" \nThis is second line\n"); printf("\tThis will print after tab space \n"); return 0; }
Program Output
The program demonstrates the usage of the \n, \t, and \” escape sequences.
—
C Tutorials
C Programming Tutorials on this website:
https://www.testingdocs.com/c-language-tutorial/