我看了關於這一問題的其他職位,但不能似乎真的將它應用到我的情況特別這篇文章:Passing a 2D array to a C++ function2維數組
int compute(int size, int graph[][size], int u, int v)
,並出現以下錯誤:
candidate function not viable: no known conversion from
'int [size][size]' to 'int (*)[size]' for 2nd argument
int compute(int size, int graph[][size], int u, int v)
當我打電話,我的主要方法,這個功能我做了以下的方法:
compute(size,matrix,0,size-1)
的我的問題是什麼?
嘗試定義'INT計算(INT大小,INT圖[] [],INT U,int v)按' – jsantander
什麼是你的代碼中的 '矩陣' 的定義是什麼? – Ryand
'matrix'都將被聲明爲'INT *矩陣大小]'而不是'INT矩陣[大小] [SIZE]'或者你必須改變你的函數的定義jsantander說。 – user3018144