C语言和指针-回顾01-常量大小
作者:互联网
字符常量'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
标签:01,int,double,float,C语言,char,3.14159,sizeof,指针 来源: https://www.cnblogs.com/wuyuntana/p/14940859.html