開發平台(Platform): (Ex: Win10, Linux, ...)
Linux
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10)
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
non.
問題(Question):
我定義一個二維陣列要引入sub function.
同時定義Link list struct裡也有相同的二維陣列
但gcc compiler解析出來的與我定義的原形不同,
不解為什麼.
我的原形:
typedef unsigned char BYTE;
typedef BYTE TestMatrix[10][10];
sub function引入變數的寫法:
LinkListNode *InserNode(LinkListNode *first, LinkListNode *theNode,
TestMatrix Matrix){
GCC Compiler fail:
test.cpp: In function ‘LinkListNode* InserNode(LinkListNode*, LinkListNode*,
BYTE (*)[10])’:
test.cpp:24:22: error: incompatible types in assignment of ‘BYTE (*)[10]
{aka unsigned char (*)[10]}’ to ‘TestMatrix {aka unsigned char [10][10]}’
inserNode->Matrix=Matrix;
餵入的資料(Input):
無
預期的正確結果(Expected Output):
compiler pass
錯誤結果(Wrong Output):
compiler fail
程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔)
https://pastebin.com/embed_js/nBEkr5rC
補充說明(Supplement):
感謝.