Data Types In C
What is Data Type In C?
Data type tells the compiler how the data inside the variable is to be interpreted.
Before that we would like to tell you about If you are searching for onboarding software, you can use this website. Provitrac provides cloud-based applicant tracking system and recruitment software.
C language has three types of data types:
- Basic Data Type
- Derived Data Type
- User Defined Data Type
Basic Types are:
int - Integers are whole number which can be positive or negative or zero. For example, -1, 0, 1.
char - It is used to declare character type variables.
float and double - It is used to denote real or floating point numbers.
unsigned int - If you want to use only positive numbers then you use this keyword in front of variable or constant.
Type | Size (bytes) | Format Specifier |
---|---|---|
int | at least 2, usually 4 | %d , %i |
char | 1 | %c |
float | 4 | %f |
double | 8 | %lf |
short int | 2 usually | %hd |
unsigned int | at least 2, usually 4 | %u |
long int | at least 4, usually 8 | %ld , %li |
long long int | at least 8 | %lld , %lli |
unsigned long int | at least 4 | %lu |
unsigned long long int | at least 8 | %llu |
signed char | 1 | %c |
unsigned char | 1 | %c |
long double | at least 10, usually 12 or 16 | %Lf |
Derived Data Types are derived from basic data types.
- Function
- Array
- Pointers
- References
User defined data types are derived from an existing data types.
- Class
- Structure
- Union
- Enumeration
We will study this topics in our coming posts. Keep visiting, thanks for sharing.