sizeof operator in c

sizeof operator in c

The sizeof operator is unary operator. it is gives the size of operand or variable of any data type in term of bytes. The operand can be variable, constant or any datatype such as(int, float, char etc). here we take example for understanding the use of sizeof operator. sizeof(int) gives the bytes occupied by the int datatype

Let us understand the concept of comma operator with example-

/* program to understand the sizeof operator*/
#include < stdio.h >
int
main()
{
int age;
printf(“size of int = %u\n”, sizeof(int));
printf(“size of float = %u\n”, sizeof(float));
printf(“size of integer constant = %u\n”, sizeof(10));
printf(“size of age = %u\n”, sizeof(age));
return 0;
}