字符串判等的问题,输出超奇怪
#include<stdio.h>int main(){
int i, j, result;
int l1, l2;
int b1, b2;
char s1, s2, s;
int str1[80], str2[80];
result=0;
b1=b2=0;
printf("Input the first string(only letter and blank permitted, end with 'Enter'):");
i=0;
while((str1[i]=getchar())!='\n'){
if(str1[i]==' ') b1++;
i++;
}
str1[i]='\0';
l1=i;
printf("Input the other string(only letter and blank permitted, end with 'Enter'):");
i=0;
while((str2[i]=getchar())!='\n'){
if(str2[i]==' ') b2++;
i++;
}
str1[i]='\0';
l2=i;
printf("l1=%d, l2=%d, b1=%d, b2=%d\n", l1, l2, b1, b2);
if(l1!=l2||b1!=b2) result=1;
else
for(i=0, j=0; i<80, j<80; i++, j++){
while(str1[i]==' ') i++;
while(str2[j]==' ') j++;
putchar(str1[i]); putchar(str2[j]);
printf("\n");
printf("result=%d\n", result);
if(str1[i]==str2[j]||(str1[i]-32)==str2[j]||str1[i]==(str2[j]-32));
else {
result=1;
break;
}
}
for(i=0; str1[i]!='\0'; i++)
putchar(str1[i]);
printf("\n");
for(j=0; str2[j]!='\0'; j++)
putchar(str2[j]);
printf("\n");
printf("result=%d\n", result);
if(result==0)
printf("YES");
else
printf("O");
return 0;
}
输入数据我用的:"www"和"www",最后输出一步,设置的状态变量result的值莫名其妙的变成了1,不懂了,求指导