赞
踩
边界值计算规律:
16,16*16=256,256*256=65536,65536*65536=42.9亿,4G*4G=1.84e+19
char c1 = 0xFF;
unsigned char c2 = 0xFF;
int main()
{
long long i = 0x80000000;
unsigned long long u = 0xFFFFFFFF;
printf("i=%I64d,u=%I64u\n", i * 5000, u * u);
return 0;
}
#include <stdio.h>
int main()
{
char ch = 99;
int n = 1234567890;
float f = 12345678.123456789f;//0.123456f
double d = 1234567890.1234567890;
//0.01234567890123456789;//1234567890123456.0;
printf("c=%c,n=%d,f=%f,d=%0.20lf\n",ch+5,n,f,d);
printf("sizeof(ch)=%d, sizeof(n)=%d, sizeof(f)=%d, sizeof(d)=%d\n",
sizeof(ch), sizeof(n), sizeof(f), sizeof(d));
//最后一行是打印所有类型变量的大小(字节数)
return 0;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。