Character and Character Set 1 - What Is A Character, What Is Character Set in C Programming Define and Explain With Suitable Examples
Character and Character Set 1 - What Is A Character, What Is Character Set in C Programming Define and Explain With Suitable Examples
Character:
Character Set:
● It's the collection of all valid characters that can be used in C programs.
● C supports two types of character sets:
1. Source Character Set (SCS):
■ The characters used to write the source code of a program.
■ It usually includes ASCII characters (128 characters) but can be extended.
2. Execution Character Set (ECS):
■ The characters a C program can process during execution.
■ It might include more characters than the SCS, depending on the system and
encoding.
Examples of Characters in C:
Typical SCS in C:
Key Points:
Example Code:
C
#include <stdio.h>
int main() {
char letter = 'C';
int ascii_code = letter; // ASCII code of 'C' is 67
return 0;
}