Escape Sequence in C

  • February 16, 2022
  • C
Matrix multiplication

The escape sequence in C represents nongraphic characters (nongraphic characters are those characters that cannot be typed directly from the keyboard, for instance, backspace, tabs, carriage return, etc). An escape sequence is represented by a backslash(\) followed by one or more characters. Escape sequences are beneficial to programmers who want to format the output.

List of Escape Sequence in C:
Escape SequenceMeaning
\aAlarm or Beep
\bBackspace
\fForm Feed
\nNew Line
\rCarriage Return
\tTab (Horizontal)
\vVertical Tab
\\Backslash
\’Single Quote
\”Double Quote
\?Question Mark
\nnnoctal number
\xhhhexadecimal number
\0Null
Example:
#include <stdio.h>

int main() {
    // Write C code here
    printf("Hello world\nCoderzpy\tC language");
    printf("\"Have a great day!\"");
    return 0;
}
Output:
Hello world
Coderzpy	C language
“Have a great day!”

Note: also read about  Comments in C & Format specifiers in C.

Follow Me

If you like my post please follow me to read my latest post on programming and technology.

https://www.instagram.com/coderz.py/

https://www.facebook.com/coderz.py

Leave a Reply

Your email address will not be published. Required fields are marked *