const char *menu_select(const char *const *items, const char *prompt);

int
main(void)
{
	const char *items[] = {, , , , NULL};
	const char *prompt = ;

	printf(, menu_select(items, prompt));

	return EXIT_SUCCESS;
}

const char *
menu_select(const char *const *items, const char *prompt)
{
	char buf[BUFSIZ];
	int i;
	int choice;
	int choice_max;

	if (items == NULL)
		return NULL;

	do {
		for (i = 0; items[i] != NULL; i++) {
			printf(, i + 1, items[i]);
		}
		choice_max = i;
		if (prompt != NULL)
			printf(, prompt);
		else
			printf();
		if (fgets(buf, sizeof(buf), stdin) != NULL) {
			choice = atoi(buf);
		}
	} while (1 > choice || choice > choice_max);

	return items[choice - 1];
}