C Data Types Examples
1. Integer Data Type (int)
Output:
2. Floating-Point Data Types (float and double)
Output:
Note:
%.nfand%.nlfcontrol the number of decimals.
3. Character Data Type (char)
Output:
4. Unsigned Data Type
-
Can only store positive values, doubling the upper limit.
Output:
5. Short and Long Integers
Output:
6. Example Combining Multiple Data Types
Output:
Key Points from Examples:
-
int → Whole numbers
-
float → Single-precision decimals
-
double → Double-precision decimals
-
char → Single characters
-
unsigned → Positive numbers only
-
short/long → Adjust memory size and range
