sizeof works with types and expressions. When you apply it to a type, () is part of the syntax sizeof : sizeof(type) . When you apply it to expression () , they are not part of the syntax sizeof : sizeof expression .
So, your second sizeof doesn't really apply to the variable. "It applies to the expression (f) . This expression consists of one variable f enclosed in an extra pair () . You can also do without this extra pair () and use only sizeof f .
When sizeof is applied to an expression, it returns the size of the result of the expression (i.e. the size of the type that this expression has). In your example, both sizeof applications are guaranteed to evaluate the same value.
In fact, a good programming practice is to avoid sizeof(type) as much as possible, i.e. prefer to use sizeof expression . This makes your code more type independent, which is always good. Type names belong to declarations and nowhere else.
source share