Logo

Programming-Idioms

History of Idiom 26 > diff from v76 to v77

Edit summary for version 77 by OC:
New Obj-C implementation by user [OC]

Version 76

2020-09-07, 14:29:26

Version 77

2020-10-10, 20:07:46

Idiom #26 Create a 2-dimensional array

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

Idiom #26 Create a 2-dimensional array

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

Variables
x,m,n
Variables
x,m,n
Code
NSArray *x=@[
  @[@0.1, @0.2, ... ], // n column values
  ... // m rows
];
Comments bubble
Object arrays are one-dimensional, but can contain nested arrays (accessible later, if needed, through x[i][j] all right). With plain-C types it would be precisely same as in plain C.