[問題] 錯誤更正: 遇到大括號編譯不過

看板C_and_CPP (C/C++)作者 (kenn )時間11年前 (2014/08/23 10:12), 編輯推噓1(102)
留言3則, 2人參與, 最新討論串1/1
我在編譯的時候,遇到一些函數的問題,和大括號有關聯 void load_user(FILE *fp,struct USER start[]){ int a,b; while(fscanf(fp,"%d",&start[a].ID)!=EOF){ fscanf(fp,"%s %s %s %d",start[a].name,start[a].password,start[a].user); for(b=0;b<10;b++){ fscanf(fp,"%d",&start[a].group[b]); } } } [Error] a function-definition is not allowed here before '{' token [Error] expected '}' at end of input -- by kenn -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.242.35.169 ※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1408759965.A.CC6.html

08/23 10:23, , 1F
while(fscanf(...) { <= 括號少了一個')'
08/23 10:23, 1F

08/23 13:49, , 2F
樓上 並沒有 原po你應該是其他段有漏括號
08/23 13:49, 2F

08/23 13:50, , 3F
然後a沒傳值進去就呼叫會有問題 雖然我猜你有省略掉code
08/23 13:50, 3F
文章代碼(AID): #1Jz_YTp6 (C_and_CPP)
文章代碼(AID): #1Jz_YTp6 (C_and_CPP)