A segfault means your program is writing to some memory it shouldn't be writing to (typically a NULL pointer).