小甲鱼 零基础入门学习C语言 视频中 关于预处理的一个小错误
#include <stdio.h>int cmp(char str1[], char str2[])
{
int i = 0, j = 0;
while (str1)
{
while (str2 == str1)
{
i++;
j++;
if (!str2)
{
return 0;
}
}
i++;
j = 0;
}
return -1;
}
int main()
{
char str;
printf("Please enterthe website you like best : ");
scanf("%s", str);
#ifndef CORRECT
#define CORRECT "fishc.com"
#endif
if ( cmp(str, CORRECT) == 0)
{
printf("You are a smart man!\n\n");
}
else
{
printf("You fool, man!\n\n");
}
return 0;
}
输入 fishc.com,会打印 You are a smart man!
输入 fishc.comlk 也会打印 You are a smart man!
所以函数实现部分是有错误的
页:
[1]