Getting the size of member variable

前端 未结 7 389
猫巷女王i
猫巷女王i 2020-12-15 17:34

If there is a POD structure, with some member variables, for example like this:

struct foo
{
   short a;
   int b;
   char c[50];
   // ...
};
相关标签:
7条回答
  • 2020-12-15 18:28

    Use this form: sizeof(foo::a) instead.

    0 讨论(0)
提交回复
热议问题