s1[i]==s2[i] && s2[i]!='\0'和s1[i]==s2[i]!='\0'有什么区别?
# include<stdio.h># include<string.h>
int main(void)
{
int i, num;
char s1[30] = {'\0'}, s2[30] = {'\0'};
printf("please enter string s1:");
gets(s1);
printf("please enter string s2:");
gets(s2);
puts(s1);
puts(s2);
for(i=0; s1[i]==s2[i] && s2[i]!='\0'; i++); // for(i=0; s1[i]==s2[i]!='\0'; i++); 就不行
if(s1[i]=='\0' && s2[i]=='\0')
num = 0;
else
num = s1[i] - s2[i];
printf("差值是%d\n", num);
return 0;
}