Assigning value to char pointer

I'm confused once again.
I thought we needed to allocate memory before assigning a value to a char*
and also that we needed to use functions like strcpy() to copy something into it.
Then how come this works and does not crash?

I thought we needed to allocate memory before assigning a value to a char*

Code:

buf = "Hello";

In the code snipped above, the string "Hello" is allocated a slot in your binary. The compiler does this when it compiles your program so you can refer to it later. Essentially this is allocating memory, but it's not being dynamically allocated - it's statically allocated, so the string exists throughout the lifetime of your program.

"The largest-scale pattern in the history of Unix is this: when and where Unix has adhered most closely to open-source practices, it has prospered. Attempts to proprietarize it have invariably resulted in stagnation and decline."