//非A即B
int IN(char *str)
{
char *str1="A";
printf("strcmp(str, str1) : %d
", strcmp(str, str1));
if(strcmp(str,str1) ==0)
{
return 1;
}
else
{
return 0;
}
}
包含头文件
#inlcude<string.h>
字符串函数
字符串长度函数strlen
strlen(arrayName);//返回 int
字符串连接函数 strcat
strcat(arrayName1, arrayName2);
字符串复制函数strcpy
strcpy(arrayName1, arrayName2);
字符串比较函数strcmp
strcmp(‘A’, ‘a’) : 1
strcmp(‘a’, ‘A’) : -1
strcmp('a', 'a') : 0