1. Pick a language for learning, C or C++.
2. "Hello" is a character constant, which has read-only memory assigned to it by the compiler.
You could imagine the code is working internally like this
Code:
#include <stdio.h>
static const char STRING_LITERAL_1[] = "Hello";
static const char STRING_LITERAL_2[] = "World!!!!!!!!";
int main(void)
{
char * buf;
buf = (char*)STRING_LITERAL_1;
printf("%s\n", buf);
buf = (char*)STRING_LITERAL_2;
printf("%s\n", buf);
return 0;
}
The static char buffers, as well as the "..." literals are all initialized at compile time. When you say buf = STRING_LITERAL_1 or buf = "..." then the address of that memory is assigned.