[問題] 讓 function 存取 array
開發平台(Platform): (Ex: VC++, Gcc, Linux, ...)
Linux
額外使用到的庫(Library Used) (Ex: OpenGL, ...)
無
問題(Question):
請問如何讓 function 存取 struct array ???
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code): (請善用置底文標色功能)
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
struct Guest {
int arri;
int tran;
int proc;
int wait;
int leave;
};
void Random ( Guest guest[10] );
int main() {
Guest guest[10];
Random ( guest[10] );
} //
補充說明(Supplement):
我就先寫到這樣 compile 看看,結果 compile 一直不能過
error: cannot convert 'Guest' to 'Guest*' for argument '1' to 'void
Random(Guest*)'
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.135.27.39
→
01/02 21:17, , 1F
01/02 21:17, 1F
→
01/02 21:18, , 2F
01/02 21:18, 2F
→
01/02 21:18, , 3F
01/02 21:18, 3F
→
01/02 21:19, , 4F
01/02 21:19, 4F
改了之後跳出 (.text+0x51): undefined reference to 'Random(Guest*)'
※ 編輯: shrekwang 來自: 140.135.27.39 (01/02 21:24)
→
01/02 21:50, , 5F
01/02 21:50, 5F
→
01/02 22:16, , 6F
01/02 22:16, 6F
→
01/03 11:44, , 7F
01/03 11:44, 7F
※ 編輯: shrekwang 來自: 221.120.65.189 (01/03 13:22)
→
01/03 13:23, , 8F
01/03 13:23, 8F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章
11
38