I am confused as to how we are able to return strings from function.
char* someFunction()
{
return "Hello, World"
}
Shouldn't the above return statement throw "function returns address of local variable" and how is it different from the function:
char* newFunction()
{
char temp[] = "Hello, World";
return temp;
}
which in fact does give the warning mentioned above.