Skip to main content
deleted 1 characters in body
Source Link
xappymah
  • 1.6k
  • 10
  • 14

leni = sizeof matrix / sizeof matrix[0][0]; it doesn't calculates the number of rows. It calculates nothing in fact.

The best way is to provide leni and lenj explicitly to function as additional parameters, like void printMatrix(int **matrix*matrix, int leni, int lenj).

Also you should know that there is no way to determine the size of some random array because it is just a pointer without any meta-information.

leni = sizeof matrix / sizeof matrix[0][0]; it doesn't calculates the number of rows. It calculates nothing in fact.

The best way is to provide leni and lenj explicitly to function as additional parameters, like void printMatrix(int **matrix, int leni, int lenj).

Also you should know that there is no way to determine the size of some random array because it is just a pointer without any meta-information.

leni = sizeof matrix / sizeof matrix[0][0]; it doesn't calculates the number of rows. It calculates nothing in fact.

The best way is to provide leni and lenj explicitly to function as additional parameters, like void printMatrix(int *matrix, int leni, int lenj).

Also you should know that there is no way to determine the size of some random array because it is just a pointer without any meta-information.

Source Link
xappymah
  • 1.6k
  • 10
  • 14

leni = sizeof matrix / sizeof matrix[0][0]; it doesn't calculates the number of rows. It calculates nothing in fact.

The best way is to provide leni and lenj explicitly to function as additional parameters, like void printMatrix(int **matrix, int leni, int lenj).

Also you should know that there is no way to determine the size of some random array because it is just a pointer without any meta-information.