Concept Flow - Basic data types
Start Program
Declare Variables
Assign Values
Use Variables
End Program
The program starts by declaring variables of different basic data types, assigns values to them, uses them, and then ends.
int a = 5; float b = 3.14f; char c = 'X'; printf("%d %f %c", a, b, c);
| Step | Action | Variable | Value | Output |
|---|---|---|---|---|
| 1 | Declare int a | a | undefined | |
| 2 | Assign 5 to a | a | 5 | |
| 3 | Declare float b | b | undefined | |
| 4 | Assign 3.14 to b | b | 3.14 | |
| 5 | Declare char c | c | undefined | |
| 6 | Assign 'X' to c | c | 'X' | |
| 7 | Print values | a,b,c | 5, 3.14, 'X' | 5 3.140000 X |
| 8 | Program ends |
| Variable | Start | After Step 2 | After Step 4 | After Step 6 | Final |
|---|---|---|---|---|---|
| a | undefined | 5 | 5 | 5 | 5 |
| b | undefined | undefined | 3.14 | 3.14 | 3.14 |
| c | undefined | undefined | undefined | 'X' | 'X' |
Basic data types in C: - int: whole numbers (e.g., 5) - float: decimal numbers (e.g., 3.14) - char: single characters (e.g., 'X') Declare variables, assign values, then use them. Uninitialized variables hold garbage until assigned.