exspression must have a constant value error

Hello,
I have two .cpp files in my project.
at the first file im using the next code:

#define row 50
#define col 100
.
.
main(){

.
.
func(row,col);// calling to function from the second .cpp file



}

and in the func(int row, int col) function im tring to declare:

int Mat[row][col]=

but i get an error massage:

exspression must have a constant value error

can you please advise?

Thanks!



Don't use #define for constants.
You forgot the return type for main.
func is not declared.
Array dimensions must be constants known at compile time.
func(int row, int col)

you must change
func()

don't use variable row and col in function prototype.
Topic archived. No new replies allowed.