Printf() Escape Sequences - C Language Basics

C examples for Language Basics:printf

Introduction

SequenceShortcut for or Equivalent to
\a Beeps the speaker
\b Backspace (moves the cursor back, no erase)
\f Form feed (ejects printer page)
\n Newline, like pressing the Enter key
\r Carriage return (moves the cursor to the beginning of the line)
\tTab
\vVertical tab (moves the cursor down a line)
\\The backslash character
\'The apostrophe
\"The double-quote character
\?The question mark
\0The "null" byte (that's 0, not the letter O)
\Onn A character value in octal (base 8)
\xnnn A character value in hexadecimal (base 16)

Demo Code

/*  //from   w ww .java  2s . co  m
   printf() escape sequence demonstration program  
*/  

#include <stdio.h>  

int main()  
{  
   printf("Here is the \\a sequence: \a");  
   getchar();  
   return(0);  
}

Related Tutorials