i believe your problem lies here. ^^^^^ Are you sure that you want a window which extends from r50,c50, then 50 cells wide and high? Is your screen really that big (at least 100 cells tall)?
When i reduce that to (50,50,10,10) the program does not segfault on me.
PS: don't forget to call endwin() to restore the terminal.