The Character Set includes all characters that the C compiler can recognize, such as letters (A-Z, a-z), digits (0-9), and special characters.
C Tokens are the smallest individual units in a program. These include:
Keywords are reserved words that have a special meaning to the compiler and cannot be used as variable names (e.g., int, float, if).
Identifiers are names used for variables, functions, and arrays.
Constants are values that remain unchanged during program execution. These can be numeric (integer, real) or character constants.
Variables are identifiers used to store data values that can change during execution.
#define preprocessor to assign a name to a constant value.Data Types specify the type of value a variable can store.
Operators are symbols that trigger an action when applied to variables and constants.
| Operator Category | Operators | Description |
|---|---|---|
| Arithmetic | +, -, *, /, % | Perform basic math like addition and modulus. |
| Relational | <, >, <=, >=, ==, != | Compare two values for true/false results. |
| Logical | &&, ||, ! | Combine multiple conditions. |
| Assignment | = | Store a value in a variable. |
| Increment/Decrement | ++, -- | Increase or decrease a value by 1. |
| Conditional | ? : | A shorthand for simple if-else statements. |
Arithmetic Expressions are combinations of variables, constants, and operators evaluated according to rules of precedence.
#define for values like PI (3.14) to make code readable and easy to maintain.Q1: What is a keyword?
A keyword is a word reserved by the C language for specific purposes (like int for integers) and cannot be used as a name for variables.
Q2: What is the difference between a constant and a variable?
A constant's value is fixed and cannot be changed during the program, whereas a variable acts as a container whose content can be modified.