Segmentation Fault in C(core dumped)–simple pointer [closed]

The pointer p is not initialized. It doesn’t point to any storage.

Here you are trying to de-reference p and store the value from h:

*p = h;

But p doesn’t point to any valid storage to hold that value.

Leave a Comment