2016年3月4日

C语言 const与指针

摘要: //const与指针 #include #include void main(){ int num1 = 10; const int num2 = 10; const int *p; p = &num1; //p可以变化 p = &num2; //p可以变化 //*p = 5; 报错 这表明p指向一个常量,这个指针不可以改变指向的数据... 阅读全文

posted @ 2016-03-04 15:41 寒魔影 阅读(256) 评论(0) 推荐(0)

2016年3月3日

C语言 复杂队列(链表队列)

摘要: //复杂的队列二 --链表队列 #include #include #define datatype int struct queuelink{ datatype data;//数据 int high;//优先级 struct queuelink *pnext;//下一节点的指针 }; typedef struct queuelink QueueLink; /... 阅读全文

posted @ 2016-03-03 14:05 寒魔影 阅读(569) 评论(0) 推荐(0)

2016年3月2日

C语言 简单的队列(数组队列)

摘要: //简单的队列 #include #include #define datatype int #define N 10 //定义队列结构体 struct queue{ int front;//队头 int endline;//队尾 datatype data[N];//数据 }; typedef struct queue Queue; Queue myQueue... 阅读全文

posted @ 2016-03-02 17:47 寒魔影 阅读(4444) 评论(0) 推荐(0)

2016年3月1日

C语言 复杂的栈(链表栈)

摘要: //复杂的栈--链表栈 #include #include #define datatype int//定义链表栈数据类型 //定义链表栈结构 struct stacklink{ datatype data; struct stacklink *pnext; }; typedef struct stacklink StackLink; //判断栈是否为空 int isem... 阅读全文

posted @ 2016-03-01 13:35 寒魔影 阅读(666) 评论(0) 推荐(0)

2016年2月29日

C语言 简单的栈

摘要: 总结:数组栈容量有限制,不可以无限大 阅读全文

posted @ 2016-02-29 15:53 寒魔影 阅读(401) 评论(0) 推荐(0)

2016年2月25日

C语言 链表的使用(链表的增删查改,链表逆转,链表排序)

摘要: //链表的使用 #define _CRT_SECURE_NO_WARNINGS #include #include #include //定义链表结构体 struct LinkCode{ int num; char sname[50]; struct LinkCode * linknext; }; //静态链表 void Linkone(){ struct ... 阅读全文

posted @ 2016-02-25 15:47 寒魔影 阅读(933) 评论(0) 推荐(0)

2016年2月22日

C语言 常用的时间函数

摘要: //时间函数的使用 #define _CRT_SECURE_NO_WARNINGS #include #include #include //time_t time(time_t *t); //如果t是空指针,直接返回当前时间。如果t不是空指针,返回当前时间的同时,将返回值赋予t指向的内存空间。 //localtime()函数 //说明:此函数获得的tm结构体的时间是日历时间。 //用 法 ... 阅读全文

posted @ 2016-02-22 16:17 寒魔影 阅读(1180) 评论(0) 推荐(0)

2016年2月19日

C语言 百炼成钢17

摘要: //题目49:老师将糖果分成若干份,让学生按任意次序领取,第一个领取的,得到1份加上剩余糖果的1/10, //第二个领取的,得到2份加上剩余糖果的1/10,第三个领取的,得到3份加上剩余糖果的1/10,以此类推, //求共有多少个学生,多少份糖果 #include #include //思路:该题的要求是求一个糖果的数量,这个数量必须保证每个学生领取到的糖果都是整份数,并不要求所有学生分的糖... 阅读全文

posted @ 2016-02-19 17:22 寒魔影 阅读(701) 评论(0) 推荐(0)

2016年2月17日

C语言 const常量讲解

摘要: //const的本质 //const本质上是伪常量,无法用于数组初始化以及全局变量初始化 //原因在于const仅仅限定变量无法直接赋值,但是却可以通过指针间接赋值 //例如局部常量在栈区,而不在静态区(静态区会一直存在),也不在代码区(代码区只读,禁止修改) #include #include //const与define的区别 #define X 10.0 const int Y = 9... 阅读全文

posted @ 2016-02-17 17:52 寒魔影 阅读(593) 评论(0) 推荐(0)

C语言 预处理三(条件编译--#if)

摘要: //#if 条件编译 //一般用于产品各个版本的语言包 #include #include //#都是预处理指令,条件表达式必须在预处理里面 //所以条件表达式必须是宏表达式 //双分支条件编译 //#if 条件表达式 //代码段1 //#else //代码段2 //#endif //#endif结束条件编译 //#if,#else和C语言里的if else功能一样,但是时间开销不一样 ... 阅读全文

posted @ 2016-02-17 17:34 寒魔影 阅读(8724) 评论(0) 推荐(0)

导航