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
  • 28,043
  • 9
  • 61
  • 79
Sherlock
  • 129
  • 1
  • 1
  • 9

0 Answers0