The sizeof Operator
来源:互联网 发布:广联达软件配置要求 编辑:程序博客网 时间:2024/05/16 15:16
// TestSizeof.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>#include <climits>int _tmain(int argc, _TCHAR* argv[]){using namespace std;int n_int = INT_MAX;int n_short = SHRT_MAX; //symbol defined in climits files;int n_long = LONG_MAX;int n_llong = LLONG_MAX;//sizeof operator yields size of type or of vatiable;cout << "int is" << sizeof(int) << "bytes." << endl;cout << "short is" << sizeof n_short << "bytes." << endl;cout << "long is" << sizeof n_long << "bytes." << endl;cout << "long long is" << sizeof n_llong << "bytes." << endl;cout << endl;cout << "Max value is" << endl;cout << "int:" << n_int << endl;cout << "short:" << n_short << endl;cout << "long:" << n_long << endl;cout << "long long" << n_llong << endl << endl;cout << "Minimum int value" << INT_MIN << endl;return 0;}
The running result:
You can apply the sizeof operator to a type name or to a variable name. When you use the sizeof operator with a type name ,suach as int, you enclose the name int parentheses. But when you use the operator with name of the variable,such as n_short,parentheses are optentional.
0 0
- The sizeof Operator
- The operator of C++ : sizeof
- sizeof Operator/sizeof运算符
- sizeof() operator demo
- operator sizeof ---compile time calculation
- overload the operator
- Explaining the PeopleCode @ operator
- qmake "The *= operator"
- perl the special operator
- The in operator
- 14.5.10 The new operator
- 14.5.11 The typeof operator
- 14.9.9 The is operator
- 14.9.10 The as operator
- The "tr///" operator in Perl
- VC++[The Interesting Logic Operator]
- C# Snippet Tutorial - The ?? Operator
- The Type Comparison Operator instanceof
- 如何在struts2的action返回结果之后再来进行费时的数据库操作呢?
- Android初学习 - 明暗度,窗体透明等的设置技巧
- poj 3414 Pots(BFS)(简单题)
- Monkey log异常分析说明
- CodeForces 546A Soldier and Bananas
- The sizeof Operator
- Oracle库Delete删除千万以上普通堆表数据的方法
- opencv中各种矩阵乘的区别
- display属性
- java快速排序实现
- Android中的UI更新
- 获得二叉树中两个节点的所有公共祖先
- synergy使用配置<Server window7 Client Fedora21>
- [Objective-C]-02-set get语法.类方法.self关键字与点语法