開發平台(Platform): (Ex: Win10, Linux, ...)
Win 7
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
Dev-C++ 5.11
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
跟小弟之前問用 qsort 排序二維陣列類似, 只是這次換成排序 array 和 struct
想宣告一個 array, 元素都是 struct, 然後去做排序
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
prog.c: In function ‘compw’:
prog.c:7:12: error: dereferencing pointer to incomplete type ‘struct data’
return (p1->x) - (p2->x);
^~
prog.c: In function ‘comph’:
prog.c:13:12: error: dereferencing pointer to incomplete type ‘struct data’
return (p1->y) - (p2->y);
程式碼(Code):(請善用置底文網頁, 記得排版)
https://ideone.com/QjGEGU
補充說明(Supplement):
看不懂哪裡出問題, 麻煩大家幫忙解惑. 感恩