摘要:
C 语言 实现双向链表 模拟ArrayList功能 可追加,插入,移除,得到指定index 的元素值.实现方法 :append,insert,Remove,getNode...View Code 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 //define the node struct 5 typedef struct tmp 6 { 7 int data; 8 int ishead; 9 struct tmp *pre; 10 struct tmp *next; 11 }intList;... 阅读全文
posted @ 2011-12-26 22:54
easyfrog
阅读(558)
评论(0)
推荐(0)
摘要:
strstr() 命令是在原字符串中查找指定的字符串第一次出现的地址,用这个特性可以实现字符的分割,判断是否包涵等功能:下面的这个例子是实现字符串以分割串分割输出: 1 #include <stdio.h> 2 #include <string.h> 3 4 int main() 5 { 6 char *str="aaa||a||bbb||c||ee||"; 7 char *sp="||"; 8 9 char *pos = strstr(str,sp); //先从原始串中寻找分割符所在地址10 char *lastPos = st 阅读全文
posted @ 2011-12-26 15:35
easyfrog
阅读(5368)
评论(0)
推荐(0)
摘要:
这段时间重拾C语言. 之前只是在大学时草草的学习了一年时间.当然与大部分同学一样.90%以上都还给了老师. 现在只是依稀得记得好像似乎大概学习过~~为什么要写这个字符串分割的实现呢. 主要也是对这段时间学习的一个总结. 觉得自带的strtok 方法实现得不够方便 .用惯了C# 还是希望他可以直接将 分割后的字串返回.其中也练习了几个知识点:结构体,指针,malloc ,释放内存等...View Code 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 5 struct ss 阅读全文
posted @ 2011-12-26 14:34
easyfrog
阅读(2503)
评论(0)
推荐(0)
浙公网安备 33010602011771号