Logo

Programming-Idioms

History of Idiom 26 > diff from v71 to v72

Edit summary for version 72 by programming-idioms.org:
Restored version 69

Version 71

2020-04-23, 08:09:43

Version 72

2020-04-23, 15:44:07

Idiom #26 Create a 2-dimensional array

Declare and initialize a matrix x having m rows and n columns, containing real numbers.

Illustration

Idiom #26 Create a 2-dimensional array

Declare and initialize a matrix x having m rows and n columns, containing real numbers.

Illustration
Code
int m=2;
int n=3;
double x[m][n];
Code
const int m = 2;
const int n = 3;
double x[m][n];
Comments bubble
This works when the values of m and n are known at compile time.
Comments bubble
This works when the values of m and n are known at compile time.