字符串处理函数 gets、 putsstrlen //求长度strcpy、strncpy //复制 while ((*destination++ = *source++) != '\0') ;strcat //拼接strcmp //比较strchr、strrchr、strstr //查找atoi、atof、itoa //数值和字符串的转化,“63”⇆ 63 处理多个字符串 二维字符数组char status[][10] = {"runing", "blocked", "ready"};字符型的指针数组char* status[] = {"runing", "blocked", "ready"}; Cautions C语言中用字符数组表示字符串字符串指针变量是个变量,指向字符串的首地址;而字符串数组名是个常量,为字符串数组第一个元素的地址,不允许修改 char word[6] = "leaf"; //no problem word = "tree"; //[Error] assignment to expression with array type char* ss; ss = "apple"; //"apple"是字符串常量,不能被修改 ss[1] = 't'; //Error ss = "good"; //no problem 定义一个字符串指针变量时,只给指针变量分配了空间,但指针变量存放的地址并没有分配,即不知道该指针到底指向哪个字符串(这种做法是危险的);而定义一个字符串数组,在编译时会占用实际的空间