# VecCopy

Copies a vector.

### Synopsis

    #include "petscvec.h"
    PetscErrorCode PETSCVEC_DLLEXPORT VecCopy(Vec x,Vec y)

Collective on Vec

### Input Parameter

x -the vector

### Output Parameter

y -the copy

### Notes

For default parallel PETSc vectors, both x and y must be distributed in the same manner; local copies are done.

### See Also

VecDuplicate()

Level:beginner
Location:src/vec/interface/vector.c
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/vec/examples/tutorials/ex1.c.html
src/vec/examples/tutorials/ex1e.c.html
src/vec/examples/tutorials/ex1f.F.html
src/vec/examples/tutorials/ex4f.F.html
src/vec/examples/tutorials/ex1f90.F.html
src/vec/examples/tutorials/ex4f90.F.html
src/ksp/examples/tutorials/ex9.c.html
src/ksp/examples/tutorials/ex28.c.html
src/ksp/examples/tutorials/ex14f.F.html
src/snes/examples/tutorials/ex3.c.html
src/snes/examples/tutorials/ex6.c.html