Invalid character test
when i execute that with 'é' it is accepted although the test! help!!
#include <stdio.h>
#include <string.h>
int main ()
{
char ch[10];
int i,k,k1;
do
{
k=0开发者_JAVA百科; i=0;
printf("Write a sentence without accentuated letters:\n");
scanf("%s",ch);
k1=strlen(ch);
while ((k==0)&&(i<k1))
{
if (ch[i]=='é') k=1;
i++;
}
}
while (k==1);
return 0;
}
The problem is probably with encoding. é
can have different numerical representation depending on the encoding standard used. If your source code editor, compiler and your command line use different encodings, things will never work this way. You might want to switch to UTF-8.
精彩评论