Skip to main content
`Ctrl`+`K`

# PetscArraycpy

Copies from one array in memory to another

## Synopsis

    #include <petscstring.h>
    PetscErrorCode PetscArraycpy(anytype *str1, const anytype *str2, size_t cnt)

Not Collective

## Input Parameters

- str1 - First array (destination)

- str2 - Second array (source)

- cnt - Count of the array, not in bytes, but number of entries in the arrays

## Notes

This routine is a preferred replacement to `PetscMemcpy()`

The arrays must be of the same type

## See Also

`PetscMemcpy()`, `PetscMemcmp()`, `PetscArrayzero()`, `PetscMemzero()`, `PetscArraymove()`, `PetscMemmove()`, `PetscArraycmp()`, `PetscStrallocpy()`

## Level

intermediate

## Location

include/petscstring.h

## Examples

src/ksp/ksp/tutorials/ex82.c
src/ts/tutorials/extchemfield.c
src/snes/tutorials/ex28.c
src/ts/tutorials/ex77.c
src/ts/tutorials/ex18.c
src/ts/tutorials/ex11.c
src/ksp/ksp/tutorials/ex73.c
src/ksp/ksp/tutorials/ex56.c
src/ts/tutorials/ex11_sa.c
src/ts/tutorials/extchem.c

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages