strcmp函数

//strcat函数
//1.此函数需要根据题目要求,去年题目要求为:返回值为ASII码的差值。
//2.真正函数中这个返回的是1或者-1。
//3.此程序以去年考试题返回差值为例。
#include
#include
#include
#include
#include
//指针
int main()
{
char str[20],str1[20];
char *p1,*p2;
scanf("%s%s",str,str1);
p1=str;
p2=str1;
while(*p1==*p2&&*p2)
{
p1++;
p2++;
}
int diff;
diff=*p1-*p2;
printf("%d",diff);
return 0;
}

相关主题
相关文档
最新文档