<分区>
Possible Duplicate:
C String literals: Where do they go?
据我所知,
generally, pointer have to be allocated by malloc(), and will be allocated to heap, then unallocated by free();
和
non pointer(int,char,float,etc..) will be allocated automatically to stack, and unallocated as long as the function go to return
但是,从下面的代码:
#include <stdio.h>
int main()
{
char *a;
a = "tesaja";
return 0;
}
a
会分配到哪里?栈还是堆?