Using sizeof operator on a typedef-ed struct

后端 未结 3 1527
攒了一身酷
攒了一身酷 2021-02-20 13:05

This might be something too obvious. However, I couldn\'t find the specific answer though many stackoverflow threads talk about different aspects of this.

typede         


        
3条回答
  •  春和景丽
    2021-02-20 13:43

    The sizeof operator have two forms:

    sizeof expression
    sizeof(type)
    

    As you're giving it a type, you need the parenthesis, sizeof(tmp)

提交回复
热议问题