我正在尝试比较并在我的两个数组中查找匹配项,但它不起作用,任何人都可以帮忙吗?
const char spam[30][30] = {"cash bonus","earn money","fast cash","free access","free gift","free membership",
"giveaway","million dollars","information you requested","act now","winner","you have been selected",
"congratulations","lose weight","meet singles","no cost","no interest","social securtiy number","bonus",
"ad","join millions","opt in","warranty","instant","prize","lowest price","get paid","get out of debt","one time","winning"};
char resp[SIZE][SIZE];//response string array
printf("Enter an email to be checked for spam\n");
scanf("%s", &resp);
//check if there is a match
for(int i = 0; i < 30; i++){
for(int j = 0; j < 30; j++){
resp[i][j] = tolower(resp[i][j]);//make it lowercase
int match = strncmp(resp[i], spam[i] );//compare
if(match == 0){
printf("This email is spam! :(\n");
}else{
printf("No match :) \n");
}//if else
}//for loop2
}//for loop1