如题所述
C语言中,int, char和short int三种类型变量所占用的内存大小因机器的不同有所不同。
一般在32位及以上机器上,int占四字节,char占一字节,short占2字节。
可以通过sizeof()()命令获取本机器上的各类型的占内存的大小,参考代码如下: