---
name: "menu_new"
section: "3x"
platform: "macos"
package: "ncurses"
version: "79"
release: "macOS 26.5"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/menu_new/3x"
---

# menu\_new(3x)

create and destroy menus

## NAME

**menu\_new** - create and destroy menus

## SYNOPSIS

**#include \<menu.h\>**\
 MENU \*new\_menu(ITEM \*\*items);\
 int free\_menu(MENU \*menu);\

## DESCRIPTION

The function **new\_menu** creates a new menu connected to a specified item pointer array (which must be **NULL**-terminated).

The function **free\_menu** disconnects *menu* from its item array and frees the storage allocated for the menu.

## RETURN VALUE

The function **new\_menu** returns **NULL** on error. It sets errno according to the function's failure:

- **E\_NOT\_CONNECTED**

  No items are connected to the menu.

- **E\_SYSTEM\_ERROR**

  System error occurred, e.g., malloc failure.

The function **free\_menu** returns one of the following:

- **E\_OK**

  The routine succeeded.

- **E\_SYSTEM\_ERROR**

  System error occurred (see **errno**).

- **E\_BAD\_ARGUMENT**

  Routine detected an incorrect or out-of-range argument.

- **E\_POSTED**

  The menu has already been posted.

## SEE ALSO

**curses**(3X), **menu**(3X).

## NOTES

The header file **\<menu.h\>** automatically includes the header file **\<curses.h\>**.

## PORTABILITY

These routines emulate the System V menu library.  They were not supported on Version 7 or BSD versions.

## AUTHORS

Juergen Pfeifer.  Manual pages and adaptation for new curses by Eric S. Raymond.
