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.
More Related Contents:
- null and NULL , Is there any difference?
- Pointers and char[] in C [closed]
- How to call function through its address in C
- How do I modify a pointer that has been passed into a function in C?
- C Programming: malloc() inside another function
- Initializing a pointer in a separate function in C
- Why does the arrow (->) operator in C exist?
- Modifying C string constants? [duplicate]
- using scanf(“%d “) with a space after the %d
- Pointer to pointer clarification
- Efficiency: arrays vs pointers
- Is NULL always false?
- Does the size of pointers vary in C? [duplicate]
- What is the meaning of “wild pointer” in C?
- Function pointer cast to different signature
- Pass a two dimensional array to a function of constant parameter
- Should one really set pointers to `NULL` after freeing them?
- Explain this implementation of malloc from the K&R book
- using printf to print out floating values
- Confusion regarding modification of const variable using pointers
- What are function pointers used for, and how would I use them?
- What’s a modern term for “array/pointer equivalence”?
- How to check if a pointer is valid? [duplicate]
- Doesn’t a 2D array decay to pointer to pointer
- Array of size 0 at the end of struct [duplicate]
- When is it valid to access a pointer to a “dead” object?
- How to check if a pointer is freed already in C?
- Returning a struct pointer
- Casting void pointers
- Cast T[][] to T*