Datatypes
Type of data which user wants to store in memory
Primitive / Predefined / Builtin
int
- negative numbers are stored in 2’s compliment notation.
- largest +ve number 32767 ()
- for more we have to use modifiers
- unsigned (without a sign bit)
- to i.e to
- long
- 4 bytes are allocated. Range to
- short
- smallest -ve number -32768 ()
- Range to
- unsigned (without a sign bit)
- Generalize nbits to ⭐ bound checking is not present in C
float
- used to define variables which can store real numbers
-
float x;
4 bytes of memory allocated for x.- Range to
- no modifiers for float
-
double
- used to define variables which can store real numbers and its range is more than float
double x;
8 bytes of memory allocated for x.- Range to
- Only one modifier: Long.
- 10 bytes of memory allocated
- to
char
- used to define variables which can store character
char x;
only 1 byte of memory is allocated for x.- to => -128 to 127
- Only one modifier Unsigned. One byte memory
- to => 0 to 255
- Character constant can initialize variable having char data
char x='a';
herea
is a character constantchar x=a;
herea
is a variable
- Character constant can be single or double ch long. It can’t be of triple characters.
void
- non returnable functions & pointers
User defined
- structure
- union
- enum