If I want to keep a constant string,
const char array[] = "Some string literal.";
Textbook C plus book says
then the quoted string is stored in the data segment, which is part of the executable file. Memory for the array is allocated only after starting the program. At this time, the quoted string is copied to the array.
Does this mean that memory is allocated twice for the string literal?
On the other hand, when it is declared using a pointer, it only allocates storage for the pointer variable and stores the address of the string literal in it.
const char *pt = "Some string literal.";
Does this mean that there is only one copy of a string literal, and declaring a pointer with a string literal is more efficient with memory than an array?