char *p; //Till here no problem
*p = 'a'; //Till is problem
printf("%c",*p); //This is problem
By declaring char pointer we have not initialized so it must be pointing to some random address.
Now if we try to access a random location we will end up with undefined behaviour as random address may work fine also but what if the random address belongs to some other process address space then we will get a segmentation fault. So its good practice to initialize the pointers.
Also we won't have compile time error rather run time error.