Segmentation Fault with pointer-to-pointer with C / Linux?

Set **S is not initized, but you dereference S in the next statement.

Up vote 3 down vote favorite 1 share g+ share fb share tw.

C pointers segmentation-fault link|improve this question edited Jan 12 '10 at 2:31Bill the Lizard?82.2k42195370 asked Apr 25 '09 at 22:16Leif Ericson502919 100% accept rate.

Set **S is not initized, but you dereference S in the next statement: *S = whatever Unless you get really, really unlucky and S is pointing to a memory location you can actually access, you're trying to dereference an invalid pointer. You would need to allocate your pointer first: Set **S; S = (S**)calloc(sizeof(S*),1); *S = getpar(); Or, alternatively (and preferable, I think): Set *S; Set **T = &S; S = getpar(); /* whatever else.

1 Thanks a lot! I spent hours on that thing. – Leif Ericson Apr 25 '09 at 22:30.

S is not initialized. Its pointing to nothing (garbage) and then you de-reference it in the next statement.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions