Tuesday, 15 January 2013

Fill dynamic array using curly bracket notation C++ -



Fill dynamic array using curly bracket notation C++ -

this question has reply here:

how initialise dynamic array in c++? 9 answers

is there way in c++ fill array allocated this

int **a = new int[4][2];

so it's filled values in 1 line this

int [4][2] = {{2,3,4},{5,6,7}};

you can in c++11 universal initialization notation:

int(*a)[2] = new int[2][2]{{1,2},{3,4}};

c++ c arrays c++11 initialization

No comments:

Post a Comment