我尝试了以下C ++代码。然而,的输出printf
和std::cout
是不同的。为什么?
struct Foo
{
int a;
int b;
int c;
};
int main()
{
printf("%d\n", &Foo::c); // The output is 8
std::cout << &Foo::c << "\n"; // The output is 1
}
Run Code Online (Sandbox Code Playgroud) c++ ×1