Want my function to move string from one array to another

I have some function:
 
int doSomething(string o[], int n)

but I want to copy elements in array o into another array. How can I do this given that o is of variable size?

To be more specific, my goal is to remove duplicate elements in an array. So, I could check if o[i] == o[i+1] and if so, o[i+1] would not be moved into the second array.
Last edited on
use std::vector<std::string> instead of string array if you can. Then you will know the total number of elements, find out duplicates and move them out. For moving can use std::move if you have a C++11 capable toolchain
String arrays don't always work, try a vector as codewalker suggested or maybe a linked list if you have an older compiler.
Starting more than one thread on essentially same question is rude.
Deleting original question from the thread is rude.

You can perform the desired operation inplace in the array without additional containers.
std::string has copy assignment operator.
Your input array o has fixed size; not variable.
There's already something for that in C++.
std::set.
Topic archived. No new replies allowed.