LINES - number of lines on terminal screen
#include <curses.h> extern int LINES;
The external variable LINES indicates the number of lines on the terminal screen.
initscr(), <curses.h>.