Initialization of array on heap
- by Radek Šimko
How do i manually initiate values in array on heap?
If the array is local variable (in stack), it can be done very elegant and easy way, like this:
int myArray[3] = {1,2,3};
Unfortunately, following code
int * myArray = new int[3];
myArray = {1,2,3};
outputs an error by compiling
error: expected primary-expression before ‘{’ token
error:…