:orphan:
# SNESGetLineSearch
Returns the line search context set with `SNESSetLineSearch()` or creates a default line search instance associated with the `SNES` and returns it.
## Synopsis
```
#include "petscsnes.h"
PetscErrorCode SNESGetLineSearch(SNES snes, SNESLineSearch *linesearch)
```
Not Collective
## Input Parameter
- ***snes -*** iterative context obtained from `SNESCreate()`
## Output Parameter
- ***linesearch -*** linesearch context
## See Also
[](ch_snes), `SNESLineSearch`, `SNESSetLineSearch()`, `SNESLineSearchCreate()`
## Level
beginner
## Location
src/snes/interface/snes.c
## Examples
src/snes/tutorials/ex15.c
src/snes/tutorials/ex1f.F90
src/snes/tutorials/ex3.c
src/ts/tutorials/ex22.c
src/ts/tutorials/ex22f.F90
src/ts/tutorials/ex27.c
src/ts/utils/dmplexlandau/tutorials/ex1f90.F90
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/snes/interface/snes.c)
[Index of all SNES routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)