how to print sizes of various data types of C
Here are the sizes of various data types in C:
#include <stdio.h>
int main() {
printf("Size of char: %ld byte\n", sizeof(char));
printf("Size of int: %ld bytes\n", sizeof(int));
printf("Size of float: %ld bytes\n", sizeof(float));
printf("Size of double: %ld bytes\n", sizeof(double));
printf("Size of short: %ld bytes\n", sizeof(short));
printf("Size of long: %ld bytes\n", sizeof(long));
printf("Size of long long: %ld bytes\n", sizeof(long long));
return 0;
}
This code will output the sizes of the various data types in C.