Why sizeof int is wrong, while sizeof(int) is right?

前端 未结 3 795
甜味超标
甜味超标 2020-12-02 08:58

We know that sizeof is an operator used for calculating the size of any datatype and expression, and when the operand is an expression, the parentheses can be o

3条回答
  •  北海茫月
    2020-12-02 09:47

    From C99 Standard

    6.5.3.4.2
    The sizeof operator yields the size (in bytes) of its operand, which may be an expression or the parenthesized name of a type.

    In your case int is neither expression nor parenthesized name.

提交回复
热议问题