# PetscObjectGetType
Gets the object type of any `PetscObject`. 
## Synopsis
```
#include "petscsys.h"    
PetscErrorCode PetscObjectGetType(PetscObject obj, const char *type[])
```
Not Collective


## Input Parameter

- ***obj -*** any PETSc object, for example a `Vec`, `Mat` or `KSP`.
Thus must be cast with a (`PetscObject`), for example,
`PetscObjectGetType`((`PetscObject`)mat,&type);



## Output Parameter

- ***type -*** the object type, for example, `MATSEQAIJ`





## See Also
 `PetscObject`, `PetscClassId`, `PetscObjectGetClassName()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/objects/gtype.c.html#PetscObjectGetType">src/sys/objects/gtype.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/objects/gtype.c)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
