:orphan:
# PetscSectionGetNumFields
Returns the number of fields in a `PetscSection`, or 0 if no fields were defined.
## Synopsis
```
#include "petscsection.h"
PetscErrorCode PetscSectionGetNumFields(PetscSection s, PetscInt *numFields)
```
Not Collective
## Input Parameter
- ***s -*** the `PetscSection`
## Output Parameter
- ***numFields -*** the number of fields defined, or 0 if none were defined
## See Also
[PetscSection](sec_petscsection), `PetscSection`, `PetscSectionSetNumFields()`
## Level
intermediate
## Location
src/vec/is/section/interface/section.c
## Examples
src/ts/tutorials/ex18.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/is/section/interface/section.c)
[Index of all PetscSection routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)