asp教程.net sizeof
简介
Pascal的一种内存容量度量函数:
C语言中判断数据类型长度符
编辑本段用法
Var
a : array[1..10000] of longint;
Begin Writeln(SizeOf(a));
End.
输出:40000
如果定义Integer,
则输出:20000
c语言中判断数据类型长度符的关键字
用法
sizeof(类型说明符,数组名或表达式);
或
sizeof 变量名
1. 定义:
sizeof是C/C++中的一个操作符(operator),简单的说其作用就是返回一个对象或者类型所占的内存字节数。
#include
using namespace std;
int main()
{
char ch;
int i;
cout << sizeof ch << ' '; // size of char
cout << sizeof i << ' '; // size of int
cout << sizeof (float) << ' '; // size of float
cout << sizeof (double) << ' '; // size of double
return 0;
}实例二
#include
union u_tag{
int i;
double d;
}u={88};
struct s_tag{
int i;
double d;
}s={66,1.234};int main()
{
int size;
size=sizeof(union u_tag);
cout<<"sizeof(union u_tag)="<u.i=100;
cout<<"u.i="<u.d=1.2345;
cout<<"u.d="<size=sizeof(u.d);
cout<<"sizeof(u.d)="<cout<<"s.i="< cout<<"s.d="< size=sizeof(struct s_tag);
cout<<"sizeof(struct s_tag)="<} sizeof类
#include
class EmptyClass {
};int main()
{
std::cout << "sizeof(EmptyClass): " << sizeof(EmptyClass)
<< 'n';
}
罚罪1+2全80集阿里云盘全集资源链接-罚罪1+2全集高清1080P/4K阿里云盘资源下载无删减
邵氏精品禁品未删减资源在线看-必看的50部邵氏电影无删减观看入口
羞羞漫画高清最新资源-正规平台免费入口与无删减资源导航
日漫入口-官方认证安全入口与无删减日漫资源直达导航
一拳超人漫画入口-2026最新免费高清全集在线看
杨紫《生命树》1080p全40集迅雷磁力链接分享-杨紫《生命树》40集高清完整版迅雷云盘下载1080P(4k)资源