In the following code, im trying to build 2 arrays. The first one is an array given by the user, the second one is an array which has been sorted among other things, although kept short since the actual implementation is not nescessary :
int size = 0;
cout << "Please enter size: ";
cin >> size;
int newArray[size] = doSomething(array,&size);
int* doSomething(int array,int *size)
//do something with the array and store it in the newArray
You have a problem here:
cin >> size; int array[size];
Unless you use
new you can't do that. The compiler creates the array container before the program runs, so you can't give it a custom size once it is running.
You must allocate your array as a new object on the heap:
cin >> size; int* array = new int[size];
Maybe this will point you in the right direction, but
I have no idea exactly what classes you are trying to call as you haven't included all of your source code.
I edited my previous answer, because I believe you are trying to simply call an array of ints, not a class called "array". If you just want a C-style array of integers, the above example is how you do it properly.
Keep in mind once you are done using the data you should call