上一页 1 ··· 7 8 9 10 11 12 13 14 下一页
摘要: 1、程序从编辑、预处理、编译、链接、装入内存、执行 编辑——在开发工具里写程序 预处理——加载一些头文件、宏替换编译——将.c 或者 .cpp文件转化为目标文件(.o)链接——将所有的.o及一些动态链接库文件(.exe .dll等)整合到一块装入内存——把整合好的东东放入内存执行——获取CPU的控制权,开始运行 比如调用一个函数printf,编译的结果会产生一条调用printf的汇编指令,但是这... 阅读全文
posted @ 2014-03-11 21:38 yexuannan 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 1、两个字符串比较是第一个不相同的字符 2、char *address=(char *)malloc(len+1); 3、txt文件的读写操作:in和out都是相对内存而言的 #include#include#include void main(){ char *listname="./result.txt"; std::ifstream in(listname); std::string fil... 阅读全文
posted @ 2014-03-10 22:02 yexuannan 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 1、C++中的using:http://blog.sina.com.cn/s/blog_61e904fd0100nuk3.html 使用using恢复、改变被继承类中的访问权限 2、野指针,没有指向的指针,与空指针的不同 3、函数指针:int (*func)(int); 指针函数:int * fun(int); 4、static_cast和reinterpret_cast的区别:共同点返回... 阅读全文
posted @ 2014-03-09 15:08 yexuannan 阅读(235) 评论(0) 推荐(0) 编辑
摘要: std::fill 在[first, last)范围内填充值:std::fill(v.begin(), v.end(), 100);http://blog.csdn.net/ilysony/article/details/6528664 #include #include #include int main(){ std::vector v; v.resize(10); std::fill(... 阅读全文
posted @ 2014-03-09 09:40 yexuannan 阅读(344) 评论(0) 推荐(0) 编辑
摘要: 引用不能被赋值http://blog.csdn.net/laixingjun/article/details/9005200 类构造函数两种初始化方法区别,哪种好:http://blog.163.com/tfn2008@yeah/blog/static/11032131920113602529911/ 指针数组,数组指针http://www.cnblogs.com/hongcha717/archi... 阅读全文
posted @ 2014-03-07 15:34 yexuannan 阅读(218) 评论(0) 推荐(0) 编辑
摘要: C++模板类是不能定义在源文件的。1.这是不允许的,因为模板类的成员函数的定义,是一种不完整的定义.2.由于编译器不知道模板参数的具体类型,无法为其成员函数生成代码.3.编译器在成员函数的调用处,才最终知道如何生成代码.总之,模板类的成员函数的定义不能像普通类的成员函数一样,定义在源代码中,而只能定义在头文件中. 一下例子将会出现错误://文件Compare.h #ifndef _COMPARE... 阅读全文
posted @ 2014-03-07 10:26 yexuannan 阅读(1974) 评论(0) 推荐(0) 编辑
摘要: 第一个问题:编译时重定义 文件1.h void fun1();struct A { int a char b;};文件2.h #include"1.h" struct B{ struct A; int a;};void fun2();文件1.cpp #include"1.h"#include"stdio.h"void fun1(){ ... 阅读全文
posted @ 2014-03-05 22:26 yexuannan 阅读(1851) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2014-03-04 16:16 yexuannan 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 采用指针存储字符串,其实质就是把字符串的首地值附给基类型为char的指针变量,从而可以从字符串首元素开始对字符串进行操作,这里面也存在一点问题. 用这个类子给大家解释解释. int main() { char *p="hello world"; p[0]='H'; printf("%s\n",p); return 0; } 运行结果会出现断错误,原因在于,*p="hello world" 这句仅仅声明了一个指针变量,指向字符串"hello world",而"hello world" 阅读全文
posted @ 2014-03-04 16:02 yexuannan 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 代码如下:#includeusing namespace std;void main(){ int i1; int i2; int i3; cout<<&i1<<endl; cout<<&i2<<endl; cout<<&i3<<endl;}以上代码就是打印出三个变量的地址(是在栈中分配内存的,向下延生),在Debug和release模式下,情况会有所不同!!可以很明显的看出,debug下每个地址之间相差12个字节;而release模式下则相差4个字节;按我们的理解每个int类型的变量应该需要4个字 阅读全文
posted @ 2014-03-04 14:56 yexuannan 阅读(837) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 下一页