:orphan:
# PetscHMapIGetWithDefault
Get the value for a key in the hash table but override the default value returned if the key was not found 
## Synopsis
```
#include <petsc/private/hashmapi.h>
PetscErrorCode PetscHMapIGetWithDefault(PetscHMapI ht, PetscInt key, PetscInt default_val, PetscInt *val)
```

## Input Parameters

- ***ht          -*** The hash table
- ***key         -*** The key
- ***default_val -*** The default value to set `val` to if `key` was not found



## Output Parameter

- ***val -*** The value





## See Also
 `PetscHMapIGet()`, `PetscHMapISet()`, `PetscHMapISetWithMode()`, `PetscHMapIIterGet()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petsc/private/generated_khash.h.html#PetscHMapIGetWithDefault">include/petsc/private/generated_khash.h</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petsc/private/generated_khash.h)


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