---
name: "key_defined"
section: "3ncurses"
platform: "linux"
package: "ncurses-doc"
version: "6.5+20250216-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/key_defined/3ncurses"
---

# key\_defined(3ncurses)

test whether a curses function key code is defined

## NAME

**key\_defined** - test whether a *curses* function key code is defined

## SYNOPSIS

```
#include <curses.h>
```

**int key\_defined(const char \*** *definition***);**

## DESCRIPTION

**The** **key\_defined** *ncurses* **extension permits a** *curses* **application to determine the function key code,** **if any,** **to which the string** *definition* **is bound.**

## RETURN VALUE

**key\_defined** **returns the first key code to which** *definition* **is bound if any exists.** **If none does,** **it returns** **0**. **If** *definition* **is a prefix of another binding,** **key\_defined** **returns** **-1**.

## EXTENSIONS

**define\_key** **is an** *ncurses* **extension.**

## PORTABILITY

**Applications employing** *ncurses* **extensions should condition their use on the visibility of the** **NCURSES\_VERSION** **preprocessor macro.**

## AUTHORS

**Thomas Dickey**

## SEE ALSO

**ncurses(3NCURSES),** **define\_key(3NCURSES),** **keybound(3NCURSES),** **keyok(3NCURSES)**
