Everyone has thus far responded by telling you to use references, which is correct, but they fail to explain why your code doesn't work. The problem here is that you do not understand pointer arithmetic.
Let's say we have a a pointer to 10 ints:
// best to use a vector for this, but for the sake of example...
int *p = new int[10];
Now, if we want to change the value of the second int in that chunk of memory we can write:
*(p + 1) = 20;
Or, the equivalent:
p[1] = 20;
See? Those two lines do the same thing. Adding n to a pointer increases the address of the pointer by n * sizeof *p bytes. Pointer arithmetic is convenient because it hides the sizeof bit from you and allows you to work with logical units (elements) instead of bytes.
So, knowing that, back to your broken code:
vet[i] = vet[j];
This indexes i * sizeof *vet bytes away from the pointer, i.e., i full vectors away from the base address. Obviously that is wrong, you wanted to invoke operator[] on the vector, i.e., treat it as an array. It is not an array however, so the correct syntax would be:
(*vec)[i]
Or
vec->operator[](i);
That said... just use a reference. Safer (object guaranteed to be valid) and idiomatic.
vetwe might be missing the crux of the error.(*vec)[i] = (*vec)[j];etc.