in the function:
how's the character string "hello world..." allocated in memory? is the momory can be freed properly if i use like that? or i have to use this:
or declare that character string as a global constant or variable will make it better?
and 1 thing, when i declare a character pointer:
in this case, we're legally access the value of this string, but cannot modify it. how is the memory is allocated? the pointer is just set to point to a beginning of that string, so is the memory allocated for it? and am i have to release its memory to return memory...
Code:
void function()
{
puts("hello world...");
}
how's the character string "hello world..." allocated in memory? is the momory can be freed properly if i use like that? or i have to use this:
Code:
void function()
{
static const char s[] = "Hello world...";
puts(s);
}
or declare that character string as a global constant or variable will make it better?
and 1 thing, when i declare a character pointer:
Code:
{
char *s = "hello world...";
}
in this case, we're legally access the value of this string, but cannot modify it. how is the memory is allocated? the pointer is just set to point to a beginning of that string, so is the memory allocated for it? and am i have to release its memory to return memory...