We mainly use this operator for giving the total amount of storage required (in bytes), for storing any object in the form of an operand. The sizeof() operator allows a user to avoid the specification of the machine-dependent type of data sizes in any program.
We generally use the sizeof() operator in the C language so that we can determine the total size of the data type or the expression that is specified in the storage units of char-size. The sizeof() operator consists of just one operand that can either be a cast data type or an expression. Here, the cast refers to a data type that is enclosed within the parenthesis in the program. Keep in mind that these data types can either be primitive like floating (float) and integer (int), or it can be compound data types, like structures (struct) and union, or it can be a pointer data type as well.