I didn't study vectors yet i want to copy the array in second array duplicate values are not allowed and in the above code the second array must have 5 values and thy must b store at the first 5 locations of the second array
Or if you did not deal with standard algorithm std::accumulate you can write simply
1 2 3 4 5 6 7 8 9 10 11 12
int firstarray[10] = {1,2,3,4,5,1,2,3,4,5};
int secondarray[10];
int *p = secondarray;
for ( int x : firstarray )
{
if ( std::find( secondarray, p, x ) == p ) *p++ = x;
}
for ( auto it = secondarray; it != p; ++it ) std::cout << *it << ' ';
std::cout << std::endl;