第一题:hellopello
: 头两题VC中编译没有错误,但是运行时有内存不能写的错误。
: 第一题中char* str1 = “hello”;
: 系统先给字符串常量”hello”分配内存,其中”hello”是const的,然后分配指针空间,把
: “hello”的首地址赋给str1。所以*str1是不能作为lvalue的。
: 第二题的问题类似。
: 但是如果改成char str1[] = “hello”;
: 就行了。因为此时系统先给字符串常量”hello”分配内存,然后为字符数组str1分配空间
: ,执行strcpy的操作,这样str1指向的空间就没有const属性了。
: 第三题中,reti是中断返回,此时不能带参数返回(指ret 4之类的),而且还要清除中