Segmentation fault typically occurs on memory violation. This can be dereferencing invalid pointers (e.g. null or pointing to memory address that does not belong to you) or trying to write memory that does not belong to your running program (e.g. uninitialized variables). Another reason could be accessing pointes that had been freed or double freeing them.
So there could be a few reasons. :)
If you need specifics, please, share your code.