Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Ada

Idiom #26 Create a 2-dimensional array

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

X : array (1 .. M, 1 .. N) of Float := (others => (others => 1.0));
const int m = 2;
const int n = 3;
double x[m][n];

This works when the values of m and n are known at compile time.

New implementation...