#8486: 是哪裡出了問題


curieastors (SMH_Curie)


#include <stdio.h>

#include <stdlib.h>

int main() 

char a[50]; 

scanf("%s",&a);

printf("Hello, %s",&a);

return 0;

#9789: Re:是哪裡出了問題


jasonlin920523 (林_頡辰)


出問題的地方:<--- 

#include

#include

int main() 

char a[50]; 

scanf("%s",&a);

printf("Hello, %s",&a);<-----以下有解答

return 0;

}  

 


因為你加了一個&

 

&a是代表"a"變數的位置

因為你不知道a變數的位置

只好用[&"變數"]代替

 printf("Hello, %s",a)裡的a變數

是代表:

%s是把後面的a變數拉進來當然!後面也要加你要輸入的變數!

 

我國小六年級...