First line: You create a pointer
variable to a char, then you initialize it to address zero (NULL pointer).
Second line: you try to write a zero to the address where pointer
is pointing to.
Address zero is outside of your process’ writable virtual memory area, so you get a segmentation fault.
solved Pointer making C program to crash