Character set of C
character:- It denotes any alphabet, digit or special symbol used to represent information.
Use:- These characters can be combined to form variables. C uses constants, variables, operators, keywords and expressions as building blocks to form a basic C program.
Character set:- The character set is the fundamental raw material of any language and they are used to represent information. Like natural languages, computer language will also have well defined character set, which is useful to build the programs.
The characters in C are grouped into the following two categories:
1. Source character set
a. Alphabets
b. Digits
c. Special Characters
d. White Spaces
2. Execution character set
a. Escape Sequence
Source character set
ALPHABETS
Uppercase letters A-Z
Lowercase letters a-z
DIGITS 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
SPECIAL CHARACTERS
~ tilde % percent sign | vertical bar @ at symbol + plus sign < less than
_ underscore - minus sign > greater than ^ caret # number sign = equal to
& ampersand $ dollar sign / slash ( left parenthesis * asterisk \ back slash
) right parenthesis ′ apostrophe : colon [ left bracket " quotation mark ; semicolon
] right bracket ! exclamation mark , comma { left flower brace ? Question mark . dot operator
} right flower brace
WHITESPACE CHARACTERS
\b blank space \t horizontal tab \v vertical tab \r carriage return \f form feed \n new line
\\ Back slash \’ Single quote \" Double quote \? Question mark \0 Null \a Alarm (bell)
Execution Character Set
Certain ASCII characters are unprintable, which means they are not displayed on the screen or printer. Those characters perform other functions aside from displaying text. Examples are backspacing, moving to a newline, or ringing a bell.
They are used in output statements. Escape sequence usually consists of a backslash and a letter or a combination of digits. An escape sequence is considered as a single character but a valid character constant.
These are employed at the time of execution of the program. Execution characters set are always represented by a backslash (\) followed by a character. Note that each one of character constants represents one character, although they consist of two characters. These characters combinations are called as escape sequence.
Backslash character constants
Character ASCII value Escape Sequence Result
Null 000 \0 Null
Alarm (bell) 007 \a Beep Sound
Back space 008 \b Moves previous position
Horizontal tab 009 \t Moves next horizontal tab
New line 010 \n Moves next Line
Vertical tab 011 \v Moves next vertical tab
Form feed 012 \f Moves initial position of next page
Carriage return 013 \r Moves beginning of the line
Double quote 034 \" Present Double quotes
Single quote 039 \' Present Apostrophe
Question mark 063 \? Present Question Mark
Back slash 092 \\ Present back slash
Octal number \000
Hexadecimal number \x
character:- It denotes any alphabet, digit or special symbol used to represent information.
Use:- These characters can be combined to form variables. C uses constants, variables, operators, keywords and expressions as building blocks to form a basic C program.
Character set:- The character set is the fundamental raw material of any language and they are used to represent information. Like natural languages, computer language will also have well defined character set, which is useful to build the programs.
The characters in C are grouped into the following two categories:
1. Source character set
a. Alphabets
b. Digits
c. Special Characters
d. White Spaces
2. Execution character set
a. Escape Sequence
Source character set
ALPHABETS
Uppercase letters A-Z
Lowercase letters a-z
DIGITS 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
SPECIAL CHARACTERS
~ tilde % percent sign | vertical bar @ at symbol + plus sign < less than
_ underscore - minus sign > greater than ^ caret # number sign = equal to
& ampersand $ dollar sign / slash ( left parenthesis * asterisk \ back slash
) right parenthesis ′ apostrophe : colon [ left bracket " quotation mark ; semicolon
] right bracket ! exclamation mark , comma { left flower brace ? Question mark . dot operator
} right flower brace
WHITESPACE CHARACTERS
\b blank space \t horizontal tab \v vertical tab \r carriage return \f form feed \n new line
\\ Back slash \’ Single quote \" Double quote \? Question mark \0 Null \a Alarm (bell)
Execution Character Set
Certain ASCII characters are unprintable, which means they are not displayed on the screen or printer. Those characters perform other functions aside from displaying text. Examples are backspacing, moving to a newline, or ringing a bell.
They are used in output statements. Escape sequence usually consists of a backslash and a letter or a combination of digits. An escape sequence is considered as a single character but a valid character constant.
These are employed at the time of execution of the program. Execution characters set are always represented by a backslash (\) followed by a character. Note that each one of character constants represents one character, although they consist of two characters. These characters combinations are called as escape sequence.
Backslash character constants
Character ASCII value Escape Sequence Result
Null 000 \0 Null
Alarm (bell) 007 \a Beep Sound
Back space 008 \b Moves previous position
Horizontal tab 009 \t Moves next horizontal tab
New line 010 \n Moves next Line
Vertical tab 011 \v Moves next vertical tab
Form feed 012 \f Moves initial position of next page
Carriage return 013 \r Moves beginning of the line
Double quote 034 \" Present Double quotes
Single quote 039 \' Present Apostrophe
Question mark 063 \? Present Question Mark
Back slash 092 \\ Present back slash
Octal number \000
Hexadecimal number \x