consider the following function that returns the address of stack-allocated
local variable:
char *fun(void)
{
Char *a = "a sunny day";
char *ptr = a;
ptr = (char*)malloc(10*sizeof(char));
return a;
}
我自己的的答案是写a sunny da
不过我跑程式他是给我a sunny day
malloc不是借了10个byte为么可以跑出11个byte的字串?