c++ - codeblocks shows error in a program but i can't find it -
void print_lcs(int b[][], string x, int i, int j){ if(i==0 || j==0) cout<<x[0]; if(b[i][j] == 1){ print_lcs(b, x, i-1, j-1); cout<<x[i]; } else if(b[i][j] == 2) print_lcs(b, x, i-1, j-1); else print_lcs(b, x, i, j-1); }
this program don't know why first line has error. error messages given below:
error: declaration of 'b' multidimensional array must have bounds dimensions except first| error: expected ')' before ',' token| error: expected initializer before 'x'|
you have pass second (column) dimension of 2d array when declaring array in function arguments. in case:
void print_lcs(int b[][column], string x, int i, int j) //replace column no of cols in 2d array
Comments
Post a Comment