C语言和指针-回顾01-常量大小
时间:2021-06-28 20:24:08
收藏:0
阅读:0
字符常量‘M‘的类型是int,大小4 bytes.
浮点数的如果没有加L(l)或者F(f),那它默认是double,大小8 bytes.
1 #include<stdio.h> 2 #include <stdbool.h> 3 4 int main() 5 { 6 int * int_p = NULL; 7 printf("char:%d,int=%d,float=%d,double=%d,long double=%d,pointer=%d\n", 8 sizeof(char),sizeof(int),sizeof(float),sizeof(double),sizeof(long double),sizeof(int_p)); 9 printf("\‘M\‘:%d,3.14159=%d\n", 10 sizeof(‘M‘),sizeof(3.14159)); 11 }
Output :
char:1,int=4,float=4,double=8,long double=16,pointer=8
‘M‘:4,3.14159=8
评论(0)