#4665: 各位大大 交一下 為什麼這樣不能過


a84011540107 (鬼月)


#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]){
   char s[0];
   while(scanf("%s",&s)){
      printf("hello, %s\n",s);
   }   
   return 0;  
}

我自己做事都沒有問題啦

可是 還是一直過不了耶

請問一下問題出在哪裡?

#4784: Re:各位大大 交一下 為什麼這樣不能過


lolomonster (lolo)


#include
#include
int main(int argc, char *argv[]){
   char s[0];
   while(scanf("%s",&s)){
      printf("hello, %s\n",s);
   }   
   return 0;  
}

我自己做事都沒有問題啦

可是 還是一直過不了耶

請問一下問題出在哪裡?

你的while 沒有結束的時候 ?
#4789: Re:各位大大 交一下 為什麼這樣不能過


popular10347 (ICPC// 哪時能唸到高等演算法T^T)


#include
#include
int main(int argc, char *argv[]){
   char s[0];
   while(scanf("%s",&s)){
      printf("hello, %s\n",s);
   }   
   return 0;  
}

我自己做事都沒有問題啦

可是 還是一直過不了耶

請問一下問題出在哪裡?

你的while 沒有結束的時候 ?

你的while迴圈沒給結束的條件,當然過不了

你必須改成while(scanf("%s",&s) != EOF){

另外,你的char s[0];

陣列大小必須大於0