使用char数组保存字符串
字符串API
http://www.kuqin.com/clib/
#include <stdio.h>
void main(){
char str[] = {'h','e','l','l','o'};
//字符串必须以'\0' 结束,否则会打印到未知数据
char str2[6] = { 'h', 'e', 'l', 'l', 'o' };
char str3[20] = "hello, world";//只能在声明时这样赋值,可以修改内容
//重新赋值
strcpy(str3,"hello, kity");
str3[0] = 'w';//正确
printf("s1-%s\n s2-%s\n s3-%s\n", str, str2, str3);
char *str4 = "how are you";
//不能修改,上面的初始化方式可以修改
//str4[0] = 'w';//错误
str4="hello,kity";//可以多次重新赋值,不能修改内容
str4 = str4 + 4;//通过指针移位
printf("s4-%s\n", str4);
getchar();
}