帮忙看一下代码错在哪
判断回文的,编译通过了,但运行时被windows终止,帮忙看看,先谢过程序代码:
#include<stdio.h> main() { char *str1="Dot saw I was tod"; char *str2="Niagara O roar again!"; printf("the palindromen:\n"); if(hw(str1)>0) printf("\n%s",str1); if(hw(str2)>0) printf("\n%s",str2); getch(); } int hw(char *string) { int i,n,m,s,len=0; for(i=0;string[i]!='\0';i++) { len++; } n=0; m=len-1; while(n<m) { if(string[n]>=65&&string[n]<=90||string[n]>=97&&string[n]<=122) {if(string[n]>=65&&string[n]<=90) string[n]=string[n]+32; } else {n++; continue; } if(string[m]>=65&&string[m]<=90||string[m]>=97&&string[m]<=122) { if(string[m]>=65&&string[m<=90]) string[m]=string[m]+32; } else {m--; continue; } if(string[n]!=string[m]) { s=-1; return s; break; } }