I found the segfault. It runs now!!!
I added proper initialization code for ncurses