Register | Sing In

New posts

Stacks in C programming Linked Lists in C programming File Input/Output in C programming Check prime numbers in C Programming C Programming Enumeration C Programming Union

Archives

2013-10 2013-09 2013-08

Escape sequence in C

August 5, 2013 Posted by: GPA Views: 1202 0 comments

The escape sequence \n means newline. If we use a newline in the string calling function printf, this escape sequence sequence set the cursor to position to the beginning of the next line on the screen. More popular escape sequences are presented below:

 

Escape sequence Description
\n Newline. Set the cursor at the beginning of the next line.
\t Horizontal tab. Set the cursor to the next tab stop.
\\ Backslash. Insert a single backslash character in a string.
\" It is double quote. Insert a double quote character in a string.
\a Call alert.Call system bell.
\b Move the cursor back one position on the current line.
\f Move the cursor to the start of the next logical page.
\r Move the cursor to the beginning of the current line.
\v Move the cursor to the next vertical tab position.
\? Output the question (?) character.
\' Output the single quote (') character.

Example:

 
 

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]){
printf("globalproganswer.com\n\n");
//\n new line
printf("\nText after new line sequence");
//\t tab
printf("Text to Tab\tText after Tab");
// \\Backslash.
printf("\nSingle Backslash \\");
//\"It is double quote.
printf("\nDouble quote \*");
//\a Call alert.
printf("\nCall system bell \a");
// \b
printf("\nMove the cursor back one position on the current line. \b");
//\f
printf("\nMove the cursor to the start of the next logical page. \f");
//\r
printf("\nMove the cursor to the beginning of the current line. \r");
//\v
printf("\nMove the cursor to the next vertical tab position \v");
//\?
printf("\nOutput the question \?");
//\'
printf("\nOutput the single quote \'character.\' ");
system("PAUSE");//delay
return 0;
}

Output

Escape sequence in C

Download this example

0 Comments...

Leave a Reply

Please, Sing In to leave a Reply for this material.



Online Chat

LiveZilla Live Help

Popular posts

Function strtok in C programming Check prime numbers in C Programming C Programming Union Linked Lists in C programming File Input/Output in C programming C Programming Enumeration

RSS-subscribe

New materials

Subscribe