1

I know for static arrays whose memory allocation is done on the stack are initialized by int array[] = {1,2,3,4,5}. I want to know how do you initialize a dynamically allocated array in C++. The following method seems wrong. int *array = new int[5]; array[] = {1,2,3,4,5};

crashmstr
  • 27,457
  • 8
  • 63
  • 78
Sherlock
  • 37
  • 7

0 Answers0