Data Types in C language

--

Data Types in C language

Data types are integer-based and floating-point-based. The memory is allocated by the operating system to variables and decides what can be stored in the reserved memory.

Sizeof() function in c language

The memory size of a data type is different as shown in the table. The function is used to find the size of a data type, sizeof().

Program

#include <stdio.h>

int main (){
printf("Size of char: %ld\n", sizeof(char));
printf("Size of short: %ld\n", sizeof(short int));
printf("Size of int: %ld\n", sizeof(int));
printf("Size of long: %ld\n", sizeof(long int));
printf("Size of float: %ld\n", sizeof(float));
printf("Size of double: %ld\n", sizeof(double));
printf("Size of void: %ld\n", sizeof(void));
return 0;
}

Output

Size of char: 1
Size of short: 2
Size of int: 4
Size of long: 8
Size of float: 4
Size of double: 8
Size of void: 1

Read more

--

--