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?
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?
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.