#include <iostream>
using namespace std;
int main()
{
int a = 1;
float b = 2;
double c = 3;
char d = 'a';
int *m = &a;
float *n = &b;
double *p = &c;
char *q = &d;
cout <<sizeof(a)<<" "<<sizeof(m)<<endl;
cout <<sizeof(b)<<" "<<sizeof(n)<<endl;
cout <<sizeof(c)<<" "<<sizeof(p)<<endl;
cout <<sizeof(d)<<" "<<sizeof(q)<<endl;
return 0;
}
编写一个 C/C++ 程序,该程序打印基本类型的大小、一些指针类型和您选择的一些枚举。使用 sizeof 运算符。
最新推荐文章于 2024-05-16 17:37:25 发布