PetscArrayzero — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# PetscArrayzero

Zeros an array in memory.

## Synopsis

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

Not Collective

## Input Parameters

- str1 - array

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

## Note

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

## See Also

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

## Level

intermediate

## Location

include/petscstring.h

## Examples

src/ts/tutorials/ex9.c
src/dm/impls/plex/tutorials/ex6.c
src/ksp/ksp/tutorials/ex35.cxx
src/ksp/ksp/tutorials/ex36.cxx
src/ksp/ksp/tutorials/ex28.c
src/ts/tutorials/ex14.c
src/tao/leastsquares/tutorials/chwirut2.c

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