我在某处读过这个问题。
char buf[]="hello";
char *buf="hello";
In terms of code generation, how do the two definitions of buf, differ?
有四个选项,我标记了
The first definition certainly allows the contents to buf to be safely modified at runtie; the second definition does not.
但事实证明,测验大师必须将以下内容标记为正确。
They do no differ-- they are functionally equivalent
为什么我的选择是错误的,因为我不能buf[3]='t'
为第二种情况做,但我可以为第一种情况做?
谢谢。