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的字串?