#6242: 為什麼會WA?


LinghongWei (DragonWei)


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
              char string[1000];
              scanf("%s", string);
              int length = strlen(string);
              char *strptr1, *strptr2;
              strptr1 = string;
              strptr2 = string+(length-1);
   
               while(strptr1 <= strptr2)
               {
                             if(*strptr1 == *strptr2)
                             {
                                         strptr1 ++;
                                         strptr2 --;
                             }             
                             else
                             {
                                         printf("no\n");
                                         break;
                             }     
               }
               if(strptr1 > strptr2)
               {
                          printf("yes\n");          
               }
               return 0;
}

系統顯示"輸出短少"...