[問題] while的判斷式裡面有陣列無法跑

看板C_and_CPP (C/C++)作者 (若自礌)時間11年前 (2014/08/11 00:00), 編輯推噓0(006)
留言6則, 5人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) VC++ 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): while裡面有陣列沒有辦法跑 餵入的資料(Input): 預期的正確結果(Expected Output): 至少能編譯QQ 錯誤結果(Wrong Output): error C2664: 'int A(double [][2])' : 無法將引數 1 從 'double' 轉換為 'double [][2]' 程式碼(Code):(請善用置底文網頁, 記得排版) #include <stdio.h> #include <stdlib.h> int main(){ double C[2][2] = { 0. }; int A(double B[2][2]); while (A(C[2][2])){ printf("good!"); } system("pause"); return 0; } int A(double B[2][2]){ return 0; } 補充說明(Supplement): 上面只是簡單把我程式用到的問題簡化,實際上上面程式沒啥特殊意義... -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.113.65.16 ※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1407686458.A.662.html

08/11 00:05, , 1F
C[2][2] 是 double ,C 才是二維陣列
08/11 00:05, 1F

08/11 00:24, , 2F
感謝!
08/11 00:24, 2F

08/11 02:19, , 3F
int A(double B[2][2]); // 這是什麼C++嗎?
08/11 02:19, 3F

08/11 02:24, , 4F
那個只是 prototype declaration
08/11 02:24, 4F

08/11 02:27, , 5F
我是智障...
08/11 02:27, 5F

08/11 12:23, , 6F
這種prototype也是很危險的寫法...
08/11 12:23, 6F
文章代碼(AID): #1JvvSwPY (C_and_CPP)
文章代碼(AID): #1JvvSwPY (C_and_CPP)