变量v的大小为12个字节,但由于它的大小为6位,为什么它不是4个字节?
#include <iostream> using namespace std; struct abc { int c : 4; char x : 1; int y : 1; } v; int main() { cout << sizeof v; // it prints 12 . why? }
c++ structure sizeof
c++ ×1
sizeof ×1
structure ×1