2015年8月27日

C++实现二叉树的基本操作

摘要: #include #include #include using std::cin; using std::cout; using std::endl; using std::stack; using std::queue; typedef struct node { int data; struct node *lchild; struct node *rchild... 阅读全文

posted @ 2015-08-27 09:40 寒叶峰 阅读(1581) 评论(0) 推荐(0) 编辑

2015年8月12日

两个数组元素的地址相减

摘要: #include using namespace std; int main() { int a[3]; a[0] = 1; a[1] = 2; a[2] = 3; //int *p, *q; //p = a; //cout << p <<'\n'; //cout << *p <<'\n'; //q = &a[2]; ... 阅读全文

posted @ 2015-08-12 18:23 寒叶峰 阅读(922) 评论(0) 推荐(0) 编辑

2015年8月6日

契约型常量、函数指针、回调函数

摘要: 契约性const对象的定义未使用const关键字,但被看做是一个const对象,例如: void ReadValue(const int& num) { cout void (*funcp)(); void FileFunc(); void EditFunc(); int main() { funcp = FileFunc; (*funcp)(); funcp... 阅读全文

posted @ 2015-08-06 09:52 寒叶峰 阅读(263) 评论(0) 推荐(0) 编辑

2015年8月5日

const用法总结

摘要: 1. const修饰变量 int b = 100; const int* a = &b; //情况1 int const* a = &b; //情况2 int* const a = &b; //情况3 const int* const a = &b; //情况4 const修饰有三种情况: 第一:const在“ * ”左边,则const用来修饰指针所指向的变量,即指针指向为常量,如情况1,... 阅读全文

posted @ 2015-08-05 10:53 寒叶峰 阅读(600) 评论(0) 推荐(0) 编辑

导航