Now vector v is changeable while z is not (passed by reference and by value respectively). You need to have the &, you cannot pass the whole vector, the & passes the address.
Be sure that you are usingnamespace std; other wise you have to use std::vector<T>.