我想知道为什么这个程序不会出现段错误?
int main(void) { char *s = malloc(sizeof(char) * 5); s = "Hello world !"; printf("%s\n", s); }
我的意思是我只分配了5个大小的字符,但它打印整个文本.
谢谢.
c
c ×1