[問題] 怎麼傳字串啊?
#include<stdio.h>
#include<stdlib.h>
int change(char &string[]);
main(){
char words[] = "abcde";
printf("%s",words);
change(words);
printf("%s",words);
system("pause");
}
int change(char &string[]){
string[0]='1';
}
編譯的時候會出現 "[Error]] declaration of 'string' as array of references"
是錯在哪裡?
p.s.第1次發文,如果有錯,請告訴我
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 36.224.41.30
→
12/04 22:44, , 1F
12/04 22:44, 1F
推
12/04 22:44, , 2F
12/04 22:44, 2F
→
12/05 19:30, , 3F
12/05 19:30, 3F
推
12/05 20:14, , 4F
12/05 20:14, 4F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章