【在 l****n 的大作中提到】 : If I put website like www.yahoo.com on my website for some reason, do I : violate the copyright of yahoo? : Please put your comment! : Thanks
What you mean by put yahoo.com on your site? You mean search or just a link?
p*n
6 楼
多谢. 发现free()之后还可以对原来的内存访问,free的作用到底是什么? #include #include char *mkarray() { char *a; a=(char *)malloc(4*sizeof(char)); a[0]='a';a[1]='r';a[2]='e';a[3]='y'; return (a); } int main() { char *b,*c; b=mkarray(); c=b+2; free(b); printf("%c %c %c %c\n",b[0],b[1],b[2],b[3]); printf("%c %c \n",c[0],c[1]); return 0; } 输出结果是 a r e y e y
【在 T*****9 的大作中提到】 : 会段错误的
b*u
7 楼
you can put my site on your page, I don't mind. :)
h*e
8 楼
the heap allocator records the size of the memory block so that you dont need to specify the size when freeing it. you can read more about the heap management.
if you rip off other people's post without permission, that would be copyrigh t infringement. What do you mean you put yahoo.com on your site??
【在 l****n 的大作中提到】 : If I put website like www.yahoo.com on my website for some reason, do I : violate the copyright of yahoo? : Please put your comment! : Thanks
p*n
12 楼
Thanks a lot.
do
【在 h*******e 的大作中提到】 : behavior undefined if you access it after freeing. likely to crash if you do : other malloc/free.