strlen
函数原型:int strlen(const char*s)
char *a="hall";
char *b="hello";
char c[9]="hello";
char d[]="ab";
printf("sizeof(a)=%d\n",sizeof(a));
printf("strlen(a)=%d\n",strlen(a));
printf("sizeof(c)=%d\n",sizeof(c));
printf("strlen(c)=%d\n",strlen(c));
printf("sizeof(d)=%d\n",sizeof(d));
printf("strlen(d)=%d\n",strlen(d));
strcmp
函数原型:int strcmp(const char *s1,const char *s2)
char *a="hall";
char *b="hello";
char c[9]="hello";
char d[]="ab";
printf("strcmp(a,b)=%d\n",strcmp(a,b));
printf("strcmp(c,a)=%d\n",strcmp(c,a));
printf("strncmp(c,b,3)=%d\n",strncmp(c,b,3));
strcpy
函数原型:char *strcpy(char *dst,const char *src)
char *a="hall";
char *b="hello";
char c[9]="hello";
char d[]="ab";
printf("strcpy(c,a)=%s\n",strcpy(c,a));
printf("c=%s\n",c);
printf("strncpy(c,b,2)=%s\n",strncpy(c,b,2));
printf("c=%s\n",c);
strcat
函数原型:char *strcat(char *s1,const char *s2)
char *a="hall";
char *b="hello";
char c[9]="hello";
char d[]="ab";
printf("strcat(c,d)=%s\n",strcat(c,d));
printf("c=%s\n",c);
printf("strncat(c,d,1)=%s\n",strncat(c,d,1));
printf("c=%s\n",c);
strchr
函数原型:char *strchr(const char *s,char c)
char *a="hall";
char *b="hello";
char c[9]="hello";
char d[]="ab";
printf("strchr(c,'l')-c=%d\n",strchr(c,'l')-c);
printf("strrchr(c,'l')-c=%d\n",strrchr(c,'l')-c);
strstr
函数原型:char*strstr(const char *s1,const char *s2)
char*s1="helloabc";
char*s2="ab";
char a[]="ello";
char b[]="ll";
printf("strstr(s1,s2)=%s\n",strstr(s1,s2));
printf("strstr(s1,a)=%s\n",strstr(s1,a));
printf("strstr(a,b)=%s\n",strstr(a,b));