随笔分类 - 《Visual C++ 入门系列教程》
摘要:C语言的字符串操作 strtok 实现字符串切割: 将字符串根据分隔符进行切割分片. #include <stdio.h> int main(int argc, char* argv[]) { char str[] = "hello,lyshark,welcome"; char *ptr; ptr
阅读全文
摘要:创建临时文件 #include <stdio.h> int main(int argc, char *argv[]) { FILE *temp; char c; if ((temp = tmpfile()) != NULL) { fputs("hello lyshark\n", temp); //
阅读全文
摘要:结构体的定义与使用: #include <stdio.h> #include <stdlib.h> struct Student { int num; char name[30]; char age; }; int main(int argc, char* argv[]) { struct Stud
阅读全文
摘要:指针数组: #include <stdio.h> #include <stdlib.h> #include <string.h> void PrintInt() { int x = 10,y = 20,z = 30; int *Array[] = { &x, &y, &z }; // 定义数组指针
阅读全文
摘要:(伪)冒泡排序算法: 相邻的两个元素之间,如果反序则交换数值,直到没有反序的记录为止. #include <stdio.h> void BubbleSort(int Array[], int ArraySize) { int x, y, temporary; for (x = 0; x < Arra
阅读全文
摘要:由于内容较少,所以,不想把它放在我的本地博客中了,暂时保存在这里,代码有一部分来源于网络,比较经典的案例,同样收藏起来。 Stack 栈容器 Stack容器适配器中的数据是以LIFO的方式组织的,它是一种先进后出的数据结构,栈允许对元素进行新增,移除,获取栈顶,等操作,但栈不允许对内部元素进行遍历,
阅读全文
摘要:实现顺序表 #include <stdio.h> #include <stdlib.h> #define MaxSize 10 int Insert_Elem(int Array[], int *len, int ins, int val) { // 首先来判断,是否是非法插入 if (*len =
阅读全文