2016年6月1日

摘要: () 和 [] 的优先级一样,但是结合性是从左往右,所以*和p先结合,说明这是一个指针 这个指针指向一个整型的数组,并且这个数组每行的长度为n,也就是p的步长。 所谓数组指针都是因为指针的步长问题 1. 数组指针(行指针) // 数组指针:指向数组的指针(在C语言里就是用来指向一个二维数组的) 定义形式:int (*p)[n]; //////////////... 阅读全文

posted @ 2016-06-01 13:34 洪爵士 阅读(155) 评论(0) 推荐(0) 编辑

摘要: 指针做函数参数: (1)有的情况下我们可能需要在调用函数中分配内存,而在主函数中使用,而针对的指针此时为函数的参数。此时应注意形参与实参的问题,因为在C语言中,形参只是继承了实参的值,是另外一个量形参的改变并不能引起实参的改变。 (2)直接使用形参分配内存的方式显然是错误的,因为实参的值并不会改变。 阅读全文

posted @ 2016-06-01 13:33 洪爵士 阅读(88) 评论(0) 推荐(0) 编辑

摘要: SeqStack.h文件 SeqStack.c文件 testSeqStack.c文件测试栈的顺序存储 阅读全文

posted @ 2016-06-01 13:19 洪爵士 阅读(150) 评论(0) 推荐(0) 编辑

摘要: LinkStack.h文件 LinkStack.c文件 testLinkStack.c文件为了测试栈的链式存储 阅读全文

posted @ 2016-06-01 13:16 洪爵士 阅读(191) 评论(0) 推荐(0) 编辑

摘要: SeqQueue.h文件 SeqQueue.c文件 testSeqQueue.c文件为了测试队的顺序存储 阅读全文

posted @ 2016-06-01 13:11 洪爵士 阅读(155) 评论(0) 推荐(0) 编辑

摘要: LinkQueue.h LinkQueue.c testLinkQueue.c测试队的链式存储 阅读全文

posted @ 2016-06-01 13:08 洪爵士 阅读(159) 评论(0) 推荐(0) 编辑

摘要: MyVector.h //模板类,不要分开多文件去写。要类的声明和类函数的实现体放在一个文件中去写。这里没有分开写//如果要岔开写的的,需要将实现体的文件 #include进来(即实现函数的.cpp文件)。 test_MyVector.cpp测试数组模板 阅读全文

posted @ 2016-06-01 12:51 洪爵士 阅读(144) 评论(0) 推荐(0) 编辑

摘要: MyString.h MyString.cpp TestMyString.cpp测试字符串类 阅读全文

posted @ 2016-06-01 12:45 洪爵士 阅读(131) 评论(0) 推荐(0) 编辑

摘要: MyArray.h MyArray.cpp TestMyArray.cpp测试这个数组类 阅读全文

posted @ 2016-06-01 12:41 洪爵士 阅读(145) 评论(0) 推荐(0) 编辑

摘要: 实现代码如下 阅读全文

posted @ 2016-06-01 11:57 洪爵士 阅读(368) 评论(0) 推荐(0) 编辑

摘要: 阅读全文

posted @ 2016-06-01 11:51 洪爵士 阅读(455) 评论(0) 推荐(0) 编辑

摘要: LinkList.h文件 LinkList.c文件 test.c文件,测试单链表 阅读全文

posted @ 2016-06-01 11:45 洪爵士 阅读(228) 评论(0) 推荐(0) 编辑

摘要: LinkList.h文件 LinkList.c文件 test.c文件 为了测试这个单链表 阅读全文

posted @ 2016-06-01 11:40 洪爵士 阅读(105) 评论(0) 推荐(0) 编辑

摘要: 阅读全文

posted @ 2016-06-01 11:19 洪爵士 阅读(130) 评论(0) 推荐(0) 编辑

摘要: #include #include #include //二叉链表示法 typedef struct BiTNode { int data; struct BiTNode *lchild,*rchild; }BiTNode; void inOrder(BiTNode *root)//中序遍历(先遍历左子树然后遍历根最后遍历右子树) { if(root==NULL) { retu... 阅读全文

posted @ 2016-06-01 11:13 洪爵士 阅读(2292) 评论(0) 推荐(0) 编辑

摘要: #include typedef struct BiTNode { char data; struct BiTNode* rchild; struct BiTNode* lchild; }BiTNode; //计算树的深度 int TreeDepth(BiTNode *root) { int right=0; int left=0; int deep=0; if(root==NU... 阅读全文

posted @ 2016-06-01 11:12 洪爵士 阅读(6292) 评论(0) 推荐(0) 编辑

摘要: 冒泡排序:相邻元素比较,满足条件就交换元素 1 #include <stdio.h> 2 void PrintArray(int *arr,int len) 3 { 4 int i=0; 5 for(i=0;i<len;i++) 6 { 7 printf("%d ",arr[i]); 8 } 9 } 阅读全文

posted @ 2016-06-01 11:07 洪爵士 阅读(146) 评论(0) 推荐(0) 编辑

摘要: 阅读全文

posted @ 2016-06-01 11:04 洪爵士 阅读(109) 评论(0) 推荐(0) 编辑