Respuesta :
C program for finding size of different data types
#include <stdio.h>
//driver function
int main()
{
int a; //declaring a of type int
float b; //declaring b of type float
double c; //declaring c of type double
char d; //declaring d of type char
long e; //declaring e of type long
long long f; //declaring f of type longlong
unsigned g; //declaring g of type unsigned
// Sizeof operator is used to evaluate the size of a variable
printf(" int data type contains: %lu bytes\n",sizeof(a));/*Finding size of int */
printf("float data type contains : %lu bytes\n",sizeof(b));/*Finding size of float */
printf("double data type contains: %lu bytes\n",sizeof(c));/*Finding size of double */
printf("char data type contains: %lu byte\n",sizeof(d));/*Finding size of char */
printf("long data type contains: %lu byte\n",sizeof(e));/*Finding size of long*/ printf("longlong data type contains: %lu byte\n",sizeof(f));/*Finding size of longlong */
printf("unsigned data type contains: %lu byte\n",sizeof(g)); /*Finding size of unsigned */
return 0;
}
Output
int data type contains: 4 bytes
float data type contains : 4 bytes
double data type contains: 8 bytes
char data type contains: 1 byte
long data type contains: 8 byte
longlong data type contains: 8 byte
unsigned data type contains: 4 byte