C program to find the size of data types
kw.c
#include <stdio.h> int main() { printf("———————————————————————————————————————————"); printf("\nProgram to find the size of data types"); printf("\n———————————————————————————————————————————"); printf("\nvoid | %ld byte", sizeof(void)); printf("\nint | %ld bytes", sizeof(int)); printf("\nchar | %ld bytes", sizeof(char)); printf("\nfloat | %ld bytes", sizeof(float)); printf("\ndouble | %ld bytes", sizeof(double)); printf("\nlong | %ld bytes", sizeof(long)); printf("\nshort | %ld bytes", sizeof(short)); printf("\nNULL | %ld bytes", sizeof(NULL)); printf("\nbool | %ld bytes", sizeof(long double)); printf("\n———————————————————————————————————————————\n"); return 0; }
Output
kodingwindow@kw:~$ gcc kw.c
kodingwindow@kw:~$ ./a.out ——————————————————————————————————————————— Program to find the size of data types ——————————————————————————————————————————— void | 1 byte int | 4 bytes char | 1 bytes float | 4 bytes double | 8 bytes long | 8 bytes short | 2 bytes NULL | 8 bytes bool | 16 bytes ——————————————————————————————————————————— kodingwindow@kw:~$
Comments and Reactions
What Next?
C program to find the range of data types
Find the output of C programsC Control StatementsAdvertisement