c++ - Passing matrix to a function -


i getting error when calling 'printmat' function. requirement create matrix after accepting number of rows , columns, , take input matrix, call printmat sending matrix , print elements. error follows:

error: parameter 'a' includes pointer array of unknown bo und 'int []'

#include<iostream> using namespace std;  int row,col;  void printmat(int* a[]) {     for(int i=0; i<row; ++i)     {         for(int j=0; j<col; ++j)         {             cout<<a[i][j]<<" ";         }     } }  int main() {        cin>>row;     cin>>col;      int mat[row][col];      for(int i=0; i<row; ++i)     {         for(int j=0; j<col; ++j)         {             cin>>mat[i][j];         }     }      printmat(mat);      return 0; } 

int* a[] 

is array of pointer, passing pointer array:

int (*a)[] 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -