Generally, segmentation faults are because a pointer of yours is either NULL, or points to random memory (probably never initialized to anything), or points to memory that was deleted.
like:
void Test()
{
char* p1 = NULL; // initialized to null, which is good but not dereferencable on many systems
char* p2; // not initialized at all
char* p3 = new char[20]; // great, it's allocated
delete [] p3; // but now it isn't anymore
// now, referencing any of these variables could cause a segmentation fault.
// here's some other possabilities:
char* p4 = new char[20];
char c = p4[21]; // reference off the end. may depend on how FAR off the end
// this one is more subtle, because we have 20 bytes allocated to a string
// and we use strcpy to copy in a 20 byte string. But, wait! There is a
// null terminator copied too, making it 21 bytes! This may not fail immediately,
// but may fail later when you allocate more memory or delete this memory.
strcpy( p4, "12345678901234567890" );
}