PetscStrallocpy — PETSc 3.25.0 documentation

Skip to main content
`Ctrl`+`K`

# PetscStrallocpy

Allocates space to hold a copy of a string then copies the string into the new space

## Synopsis

    static inline PetscErrorCode PetscStrallocpy(const char s[], char *t[]) PeNS

Not Collective, No Fortran Support

## Input Parameter

- s - pointer to string

## Output Parameter

- t - the copied string

## Notes

`NULL` string returns a new `NULL` string.

Use `PetscFree()` to release the data when it is no longer needed.

If `t` has previously been allocated then that memory is lost, you may need to `PetscFree()` the array before calling this routine.

## See Also

`PetscStrArrayallocpy()`, `PetscStrNArrayallocpy()`

## Level

intermediate

## Location

include/petscstring.h

## Examples

src/ts/tutorials/ex9.c
src/snes/tutorials/ex48.c
src/ts/tutorials/ex11.c
src/ts/tutorials/ex18.c
src/mat/tutorials/ex7.c
src/ts/tutorials/ex14.c

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