我正在尝试使用 isaplha() 函数来检查每个字符串的每个字符以确保它是否是字母。但由于某种原因,它不起作用。尽管有 if 语句的参数,程序总是进入 printf() 函数。代码似乎一切正常:
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define N 5
int main(void)
{
char string[N][50];
int i,j;
printf("Enter an array of N strings:\n");
for(i=0;i<N;i++){
gets(string[i]);
}
for(i=0;i<N;i++){
for(j=0;j<50;j++){
if(isalpha(string[i][j])){
printf("\nIt should not work with numbers");
}
}
}
return 0;
}