#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void check(char *a, char *b, int (*cmp)(const char *, const char *));
int main(int argc, char *argv[])
{
char s1[80],s2[80];
int (*p)(const char *, const char *);
p = strcmp;
printf("输入两个字符串: \n");
gets(s1);
gets(s2);
check(s1, s2, p);
system("pause");
return 0;
}
void check(char *a, char *b, int (*cmp)(const char *, const char *))
{
printf("测试是否相等\n");
if(!(*cmp)(a, b))
printf("结果:相等\n");
else
printf("结果:不相等\n");
}
|