最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp.net sizeof的用法
时间:2011-06-06 编辑:简简单单 来源:一聚教程网
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';
}
相关文章
- 理解Asp.Net中WebForm的生命周期 06-20
- asp.net中使用母版制作出的页脚效果 05-17
- ASP.NET在使用X509Certificate2出现问题时的一些解决方法 05-16
- ASP.NET 定时器回调方法的重入 04-20
- 剖析Asp.Net Web API路由系统---WebHost部署方式 04-13
- Asp.net用Button打开另一个的frm的教程 12-26