# PetscObjectSetName

Sets a string name associated with a PETSc object.

### Synopsis

    #include "petsc.h"
    PetscErrorCode PETSC_DLLEXPORT PetscObjectSetName(PetscObject obj,const char name[])

Not Collective

### Input Parameters

| obj | - the Petsc variable Thus must be cast with a (PetscObject), for example, PetscObjectSetName((PetscObject)mat,name);
| name | - the name to give obj

### See Also

PetscObjectGetName()

Level:advanced
Location:src/sys/src/objects/pname.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/vec/examples/tutorials/ex3.c.html
src/ksp/examples/tutorials/ex1.c.html
src/ksp/examples/tutorials/ex3.c.html
src/snes/examples/tutorials/ex2.c.html
src/snes/examples/tutorials/ex3.c.html
src/snes/examples/tutorials/ex5.c.html
src/snes/examples/tutorials/ex30.c.html