0概念复习
gcc旨在编译 C 语言代码。g++旨在编译 C++ 语言代码。
1.定义常用
#define pi 3.14
int m,n,i,sum,k=1,count=0,t;
#include <ctype.h>
#include <string.h>
2.函数常用
3.应试回答和八股
char x[5]={'a','b','\0','c','\0'};
printf("%s",x);
由于 %s 格式化字符串是以 \0 结尾来确定字符串的结束位置,因此 printf("%s", x); 只会输出前两个有效字符 'a' 和 'b',后面的 'c' 不会被输出。因此,最终输出为 ab
char b[10]={'1', '2', '3'};
printf("%d\n",strlen(b)); //3
printf("%d\n",sizeof(b)); //10
7.12345 %3.2f 的格式化输出,结果将是 7.12. 最小三位宽
"Hello",按照 %2.3s 的格式化输出,结果将是 "Hel"。最小两位宽