---
name: "key_defined"
section: "3x"
platform: "linux"
package: "ncurses"
version: "6.6-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/key_defined/3x"
---

# key\_defined(3x)

obtain key code for an ncurses function key definition

## NAME

**key\_defined** - obtain key code for an *ncurses* function key definition

## 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 bound definition,** **key\_defined** **returns** **-1**.

## EXTENSIONS

**key\_defined** **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

**curses(3X),** **define\_key(3X),** **keybound(3X),** **keyok(3X)**
