简单的复习一下字符数组的相关知识(见代码)
#include <stdio.h> #include <string.h> #include <stdlib.h> int main() { char a[20],b[10]; gets(b); //scnaf("%s",b); puts(b); //printf("%s",b); strcpy(a,"Hello,"); //""内的字符串复制给a strcat(a,b); //b接在a上 if(strcmp(a,b)<0) puts(a); //比较a,b的长度,相等为0,a大为正,b大为负 else exit(2); return 0; }