Use an escape sequence between a pair of single quotes to specify a character constant - C Data Type

C examples for Data Type:char

Introduction

Escape sequence Description
\n Represents a newline character
\r Represents a carriage return
\b Represents a backspace
\f Represents a form-feed character
\t Represents a horizontal tab
\v Represents a vertical tab
\a Inserts a bell (alert) character
\? Inserts a question mark ( ?)
\" Inserts a double quote ( ")
\' Inserts a single quote ( ')
\\ Inserts a backslash (\)

Demo Code

#include <stdio.h> 
  
int main(void) 
{ 
    char newline = '\n';
    char tab = '\t';
    char single_quote = '\'';
    //www  .j  a v  a2s  .co  m
    printf("The character is %c\n", single_quote);
    
    return 0; 
}

Result


Related Tutorials