In this lesson, you will learn,
Like English or any other language is used for communication, the C language is one of the computer programming languages used to communicate with a computer.
Learning the C language is similar to learning any other language, such as English. Like English, it involves learning starting with the alphabet, words, sentences, and paragraphs, while C focuses on understanding similar steps as shown in the figure below.

In C programming, the character set refers to the set of valid characters that are recognized and allowed while writing C programs.
These characters are used to form tokens like keywords, identifiers, constants, operators, and expressions.
| Category | Characters | Examples / Usage |
|---|---|---|
| 1. Letters(Alphabets) | A–Z, a–z | int, main, printf, char, sum |
| 2. Digits | 0–9 | 10, 99, value1, number2 |
| 3. Special Symbols | Various symbols used in syntax | ~ ‘ ! @ # % ^ & * ( ) _ – + = | \ { } [ ] : ; ” ‘ < > , . ? / |
A token is a basic building blocks and known as the smallest meaningful unit in a C program.
It is created from the C character set. The C character set provides letters, digits, symbols, and whitespace, which are combined to form tokens.
For example:
int is a keyword token, formed using letters from the character set.
123 is a constant token, formed from digits.
+, = are operator tokens, formed from special characters.
So, the character set provides the raw material, and tokens are the meaningful building blocks.
There are 5 primary types of tokens in the C language:

Identifiers are user-defined names for variables, functions, arrays, structure etc. and it is created by the programmer.
Rules:
Must begin with a letter (A–Z or a–z) or underscore _.
Can contain letters, digits, and underscores.
Cannot use keywords as identifiers.
Case-sensitive
| Identifier | Reason |
|---|---|
count | Starts with a letter, no special chars |
num1 | Contains digits after letters |
_value | Starts with underscore |
AverageMarks | Follows all rules |
sum_2025 | Letters, digits, underscore |
| Identifier | Reason |
|---|---|
1data | Starts with a digit |
float | Reserved keyword in C |
@count | Contains invalid character @ |
total-value | Contains hyphen - (not allowed) |
marks# | Contains #, which is not a valid symbol |
Keywords are reserved words that have predefined meanings.
These words are part of the C language syntax and cannot be used as identifiers (variable names, function names, etc.).
| Property | Description |
|---|---|
| Reserved | You cannot use them as variable names. |
| Lowercase | All keywords are written in lowercase. |
| Part of syntax | Used for data types, control flow, etc. |
| Compiler-recognized | The compiler knows the meaning and function. |
| auto | break | case | char |
|---|---|---|---|
| const | continue | default | do |
| double | else | enum | extern |
| float | for | goto | if |
| int | long | register | return |
| short | signed | sizeof | static |
| struct | switch | typedef | union |
| unsigned | void | volatile | while |
| Keyword | Meaning |
|---|---|
int | Declares an integer variable |
float | Declares a floating-point variable |
char | Declares a character variable |
if | Conditional statement |
else | Alternate path of execution when if fails |
while | Looping construct |
for | Looping construct |
do | Executes loop body first, then checks condition |
return | Returns a value from a function |
void | Specifies that a function does not return a value |
break | Exits a loop or switch statement |
continue | Skips the current iteration of a loop |
switch | Multi-way branching statement |
case | Defines individual cases in a switch |
default | Executes if no case matches in switch |
sizeof | Returns the size (in bytes) of a data type |
struct | Declares a structure (user-defined type) |
union | Declares a union (shared memory for multiple variables) |
typedef | Defines new data type names |
const | Declares a constant (read-only) variable |
volatile | Tells the compiler the variable may change unexpectedly |
enum | Declares enumerated constants |
goto | Jumps to a labeled statement |
static | Preserves the value of a variable between function calls |
extern | Declares a variable defined elsewhere |
register | Hints to store variable in CPU register for fast access |
signed | Declares signed variables (can hold negative values) |
unsigned | Declares unsigned variables (only positive values) |
long | Declares long integer data type |
short | Declares short integer data type |
auto | Automatically defines storage class (default for local variables) |
A constant is a fixed value that does not change during the execution of a program. Constants are used to store values that must remain the same throughout the program.
| Type | Description |
|---|---|
| 1. Integer Constants | Whole numbers (positive or negative) |
| 2. Floating-point Constants | Numbers with decimal points |
| 3. Character Constants | Single character enclosed in single quotes |
| 4. String Constants | Sequence of characters in double quotes |
| 5. Enumeration Constants | Named set of integer constants |
| 6. Symbolic Constants | Named constant defined using #define |
Represent whole numbers (with no decimal).
Can be in decimal, octal, or hexadecimal format.
int a = 25; // Decimal
int b = 032; // Octal (starts with 0)
int c = 0x2A; // Hexadecimal (starts with 0x)
Represent numbers with a decimal point or in exponential form.
float pi = 3.14;
double gravity = 9.8;
float sci = 1.23e3; // 1.23 × 10³ = 1230
A single character enclosed in single quotes.
char ch = 'A';
char newline = '\n'; // Special character constant
A sequence of characters enclosed in double quotes.
printf("Hello, World!");
char name[] = "Amit";
Used to define a set of named integer constants using enum.
enum days { SUN, MON, TUE, WED };
enum days today = MON; // today = 1
Defined using the #define preprocessor directive.
#define PI 3.1415
#define MAX 100
printf("Value of PI is: %f", PI);
There are no reviews yet. Be the first one to write one.
You must be logged in to submit a review.