ALEXKK2011

The Technical Side of alexKK2011
  博客园  :: 新随笔  :: 订阅 订阅  :: 管理

2011年2月23日

摘要: 这个帖子收集了两个在网上比较流行的对堆和栈的理解,看了感觉比较清晰,随记之。 转自:http://hi.baidu.com/spacetimer/blog/item/8650a4ccba36831000e92819.html 在bbs上,堆与栈的区分问题,似乎是一个永恒的话题,由此可见,初学者对此往往是混淆不清的,所以我决定拿他第一个开刀。 首先,我们举一个例子: void f() { int* ... 阅读全文

posted @ 2011-02-23 00:05 alexkk2011 阅读(139) 评论(0) 推荐(0) 编辑

2011年2月22日

摘要: #include <iostream>#include <string>using namespace std;void main(){ //exp.4 char *charPtr=NULL; cout << "*charPtr = NULL" << endl; //cout << "*charPtr is : " << *charPtr << endl; //运行时错误:sizeof.exe 中... 阅读全文

posted @ 2011-02-22 23:03 alexkk2011 阅读(157) 评论(0) 推荐(0) 编辑

摘要: 来自bccn C语言论坛:http://bbs.bccn.net/thread-82212-1-1.html在C语言的学习中,对内存管理这部分的知识掌握尤其重要!之前对C中的malloc()和free()两个函数的了解甚少,只知道大概该怎么用——就是malloc然后free就一切OK了。当然现在对这两个函数的体会也不见得多,不过对于本文章第三部分的内容倒是有了转折性的认识,所以写下这篇文章作为一个对知识的总结。这篇文章之所以命名中有个“浅谈”的字眼,也就是这个意思了!希望对大家有一点帮助!如果不扯得太远的话(比如说操作系统中虚拟内存和物理内存如何运做如何管理之类的知识等),我感觉这篇文章应该是 阅读全文

posted @ 2011-02-22 16:25 alexkk2011 阅读(120) 评论(0) 推荐(0) 编辑

摘要: #include <iostream>#include <string>using namespace std;void main(){ //exp.3 char *charPtr; //if this printer is not initialized, when it is used, //run-time check failure#3- the variable 'charPtr' is... 阅读全文

posted @ 2011-02-22 15:28 alexkk2011 阅读(123) 评论(0) 推荐(0) 编辑

摘要: //==========chartype.cpp==========#include <iostream>#include <string>using namespace std;void main(){ //exp.2 //char charArray[] = {"abc", "defg"}; //编译错误初始值设定项太多 char charArray[] = {"abcde"}; char *... 阅读全文

posted @ 2011-02-22 15:07 alexkk2011 阅读(149) 评论(0) 推荐(0) 编辑