Blogware Logo
Blogware
Home
Celebriware
Feedback
Need Help?
ImageSurajit Nandy
Published on : 30th Sep 2021
Cover Image
Escape sequences in C programming #coding #programming #C #developer #development
Escape sequences is used to format output. It is composed of two or more characters starting with \ (Backslash).
Let's us discuss some useful escape sequences in C programming.
\n => New line
\b => Backspace
\t => Horizontal tab
\v => Vertical tab
\r => Carriage return (Go to the beginning of the current line)
\' => Single quote
\" => Double quote
\\ => Backslash
\f => Form feed (go the next page or section)
\ddd => Octal number
\xdd => Hexadecimal number
\0 => Null value (It's backslash followed by zero.)
Example:
#include <stdio.h> int main(int argc, char** argv) { char num1[] = "\276"; char num2[] = "\x38"; printf("How are you?\nI'm fine."); printf("\n"); printf("Octal number = %s\n", num1); printf("Hexadecimal number = %s\n", num2); return 0; }
Output:
How are you? I'm fine. Octal number = ╛ Hexadecimal number = 8
Explanation:
Here, \n is used to print a new line.
In num1, \276 is converted to to its equivalent ASCII number, then it is getting printed.
The similar thing is happening for num2.
CelebriwareProductsServicesAdvertisementInvestorsPrivacy PolicyTerms of Service
Blogware Logo
Copyright © 2026 Blogware. All rights reserved.