#include <stdio.h>
int main()
{//第2章 P22
float b = (3.14+1e20)-1e20;
float c = 3.14+(1e20-1e20);
/* 我的第一个 C 程序 */
printf("Hello, World! \n");
printf("%f\n",3.14+1e20);
printf("%f\n",b);
printf("%f\n",c);
return 0;
}
#include <stdio.h>
#include <string.h>
int main()
{
/*
sizeof 和strlen的区别
*/
char buf[]="abcde";
char buf2[100]="abcde";
char *buf3="abcde";
printf("sizeof:%d strlen: %d\n",sizeof(buf),strlen(buf));
printf("sizeof:%d strlen:%d\n",sizeof(buf2),strlen(buf2));
printf("sizeof:%d strlen: %d\n",sizeof(buf3),strlen(buf3));
//strlen: both are 5
//sizeof: the total size of the array 6 and 100
//sizeof: pointer The size of the pointer is always 4
return 0;
}
int main()
{//第2章 P22
float b = (3.14+1e20)-1e20;
float c = 3.14+(1e20-1e20);
/* 我的第一个 C 程序 */
printf("Hello, World! \n");
printf("%f\n",3.14+1e20);
printf("%f\n",b);
printf("%f\n",c);
return 0;
}
#include <stdio.h>
#include <string.h>
int main()
{
/*
sizeof 和strlen的区别
*/
char buf[]="abcde";
char buf2[100]="abcde";
char *buf3="abcde";
printf("sizeof:%d strlen: %d\n",sizeof(buf),strlen(buf));
printf("sizeof:%d strlen:%d\n",sizeof(buf2),strlen(buf2));
printf("sizeof:%d strlen: %d\n",sizeof(buf3),strlen(buf3));
//strlen: both are 5
//sizeof: the total size of the array 6 and 100
//sizeof: pointer The size of the pointer is always 4
return 0;
}