字符串拷贝
char*s1="helloabc";
char*s2=(char*)malloc(strlen(s1)+1);
printf("strcpy(s2,s1)=%s\n",strcpy(s2,s1)); //strcpy(s2,s1)=helloabc
printf("s2=%s\n",s2); //s2=helloabc
free(s2);
字符搜索
char s1[]="helloabc";
//'l'第一次出现之后的字符串
printf("strchr(s1,'l')=%s\n",strchr(s1,'l')); //strchr(s1,'l')=lloabc
//'l'第一次出现的位置
printf("strchr(s1,'l')-s1=%d\n",strchr(s1,'l')-s1); //strchr(s1,'l')-s1=2
//'l'第二次出现之后的字符串
char*s2=strchr(s1,'l');
printf("strchr(s2+1,'l')=%s\n",strchr(s2+1,'l')); //strchr(s2+1,'l')=loabc
//'l'第二次出现的位置
printf("strchr(s2+1,'l')-s1=%d\n",strchr(s2+1,'l')-s1); //strchr(s2+1,'l')-s1=3
//'l'第二次出现之前的字符串
char*c=strchr(s2+1,'l');
*c='\0';
printf("%s\n",s1); //hel