Is the code correct?
Yes, your code is (almost) excellent, because it "string"is a string literal and is in static storage.
Note. A pointer is simply a variable in which the memory address is stored. This string simply stores the address of the string literal "string" inside a variable named temp.
char *temp = "string";
++ , , . , .
?
++ 03 () , :
" n const char" (3.7),
3.7.1 - 1:
, . .
:
char*, const char *. undefined, , .
. "string", , , .