> I understand that, but my compiler (gcc) gave me a segmentation fault when I ran it
Well that's what you get for ignoring warnings, and passing garbage into functions.