I am confused about how to create a dynamic defined array:
int *array = new int[n];
I have no idea what this is doing. I can tell it\'s c
In C/C++, pointers and arrays are (almost) equivalent. int *a; a[0]; will return *a, and a[1]; will return *(a + 1)
int *a; a[0];
*a
a[1];
*(a + 1)
But array can't change the pointer it points to while pointer can.
new int[n] will allocate some spaces for the "array"
new int[n]