手机
当前位置:查字典教程网 >编程开发 >C语言 >解决不用sizeof求出int大小的方法
解决不用sizeof求出int大小的方法
摘要:代码如下所示:复制代码代码如下:#includeintmain(intargc,char*argv[]){inta[2];unsignedi...

代码如下所示:

复制代码 代码如下:

#include <stdio.h>

int main(int argc, char *argv[])

{

int a[2];

unsigned int add1 = &a[0];

unsigned int add2 = &a[1];

printf("The address of a[0] is %u/n",add1);

printf("The address of a[1] is %u/n",add2);

printf("The size of int is %u/n", add2 - add1);

}

输出结果是:

The address of a[0] is 3218821936

The address of a[1] is 3218821940

The size of int is 4

【解决不用sizeof求出int大小的方法】相关文章:

C++ 关于STL中sort()对struct排序的方法

深入理解约瑟夫环的数学优化方法

sizeof()的简单介绍

用C实现PHP扩展 Fetch_Url 类数据抓取的方法

使用ShellClass获取文件属性详细信息的实现方法

linux c程序中获取shell脚本输出的实现方法

解析在WTL下使用双缓冲的实现方法

VC WinExec打开指定程序或者文件的方法

C++调试追踪class成员变量的方法

数组中求第K大数的实现方法

精品推荐
分类导航