I am new to C++ programming but I have experience in java.
In java I can create an array by allocating it a size only.
int[] array = new int[10] // 1
Later, I can assign a new array to the existing one.
array = new int[4]; // 2
Similarly, in C++, I can create an array using:
int array[10]; // 3
This will allocate an array of 10 elements. How can I achieve step 2 in C++ like I did in java.
Update:
Thanks for your help @idclev-463035818 but, the question you referenced me to does not answer my question. I want to assign a new array to an existing one with a different size. I don't want to copy the elements of the existing array. Also, I don't want to use pointers or dynamic array. I just wanted to know if step 2 is possible in C++ or not.