ex11-04.cpp

来自「数据结构常用算法合集」· C++ 代码 · 共 19 行

CPP
19
字号
//EX11-04.cpp
#include <iostream.h>	//cout,cin
#include <conio.h>		// getch()
union u_type
{ float r;
  char ch;
  short n;
}u;
void main()
{ 
  cout << "Total bytes="
       << sizeof(u_type)
       <<"\n r  has:"<<sizeof(u.r)
       <<"\n ch has:"<<sizeof(u.ch)
       <<"\n n  has:"<<sizeof(u.n);
  getch();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?