0

How does memory gets allocated for a string literal in C and do we need to free it? E.g.:

char *k="hello world";

Where does this string get stored and how does it get de-allocated?

1

1 Answer 1

1

where does this string get stored

Usually in read-only memory, you cannot modify it. In gcc, on most systems, they are located in the .TEXT section.

how does it get de-allocated

upon program termination.

Not the answer you're looking for? Browse other questions tagged or ask your own question.