Usually, variables are deleted when out of scope.
Am I right so far?
int number = 5;
pointer = &number;
// now, outside the brackets, pointer points to freed memory and should not be used.
Text have the type (const char*), so I figured that text are arrays of chars stored in memory, and that (const char*) points to the first element.
That's all good.
But take a look at this code:
Isnt text freed when out of scope in C?
const char *pointer;
const char *text = "This is a text";
pointer = text;
// What about pointer(outside of brackets) here?
If so, is this because text-constants are created using malloc, behind the scences?
And if so, If i were to create a program with LOTS of text, wouldnt I need to manually free memory taken from text-constants?