initscr() will read the proper terminfo file and initialize the ncurses data structures, allocate memory for and and set and to the values the terminal has. It will return a pointer to or ERR when an error has occured. You don't need to initialize the pointer with:
initscr() will do this for you. If the return value is ERR, your program should exit because no ncurses function will work:
An additional call to refresh() after endwin() will restore the terminal to the status it had before calling initscr() (visual-mode) otherwise it will be cleared (non-visual-mode).