3条回答 默认 最新
- qtchen_1988 2019-09-20 10:37关注
你可以这么定义
union CTOF { int weight; float f; }ctof; int main() { ctof.weight = 100; return 0; }
或者:
union CTOF { int weight; float f; }; union CTOF ctof; int main() { ctof.weight = 100; return 0; }
但不能像你那样定义;
还有,你共同体内是int Weight ; w是大写的,定义的时候是小写的。不注意细节本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报