可能重复:
C++:空类对象的大小是多少?
为什么以下输出1?
#include <iostream>
class Test
{
};
int main()
{
std::cout << sizeof(Test);
return 0;
}
Run Code Online (Sandbox Code Playgroud) 为什么这段代码中的条件true?
int main ( )
{
if ("")
cout << "hello"; // executes!
return 0;
}
Run Code Online (Sandbox Code Playgroud)