Logo

Programming-Idioms

History of Idiom 26 > diff from v69 to v70

Edit summary for version 70 by ThinkingHorse:
[C] There was no point in Mand n in the previous example AFAICS

Version 69

2020-03-20, 17:58:40

Version 70

2020-04-23, 08:08:18

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
const int m = 2;
const int n = 3;
double x[m][n];
Code
double x[2][3];
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.