欢迎来到工商注册核名查询系统!

C语言

当前位置:主页 > 软件编程 > C语言 >

解决不用sizeof求出int大小的方法

来源:本站原创|时间:2022-11-25|栏目:C语言|

代码如下所示:

复制代码 代码如下:

#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

更多C语言

您可能感兴趣的文章

阅读排行

本栏相关

随机阅读

网页制作CMS教程网络编程软件编程脚本语言数据库服务器

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:835971066 | 邮箱:835971066#qq.com(#换成@)

Copyright © 2002-2020 工商注册核名查询系统 版权所有