sizeof Operator in C
For Complete YouTube Video: Click Here
In this class, we will try to understand the sizeof Operator in C.
We have already discussed the concepts of data types in our previous classes.
So far, we have assumed that int occupies 4 bytes of space double occupies 8 bytes of space.
In C, we have an operator called sizeof which outputs the size of a data type, variable, or expression.
Table of Contents
sizeof Operator in C
The sizeof() operator is a unary operator used to compute the size of its operand.
Example
To understand this concept, consider the programming example as shown below.
In the above image, we have considered different possibilities for the sizeof operators.
The output of the program is as shown below.
4
8
8
4
4
8
1
8