标签:
判断以下题目是否正确,不正确指出错误并改正。
#include <iostream> using namespace std; struct a { int x:1; int y:2; int z:33; }; int main() { a d; cout << &d << endl; d.x = 1; d.y = 3; d.z = d.x + d.y; cout << d.x << " " << d.y << " " << d.z << " " << sizeof(d) << endl; return 0; }
析:
Z分配了33位,超出了4字节,发生越界错误。
标签:
原文地址:http://www.cnblogs.com/aqing1987/p/4221048.html