C examples for Data Type:sizeof
sizeof operator takes a variable name or data type as an argument and returns the number of bytes required to store the data in memory.
#include <stdio.h> int main()/*from w w w. j av a 2 s . co m*/ { int x; float f; double d; char c; typedef struct employee { int id; char *name; float salary; } e; printf("\nSize of integer: %d bytes\n", sizeof(x)); printf("Size of float: %d bytes\n", sizeof(f)); printf("Size of double %d bytes\n", sizeof(d)); printf("Size of char %d byte\n", sizeof(c)); printf("Size of employee structure: %d bytes\n", sizeof(e)); }