- 博客(12)
- 收藏
- 关注
原创 c语言小游戏 贪吃蛇源码 linux下运行
#include <curses.h> #include <stdlib.h> #define up 1 #define down -1 #define left 2 #define right -2 struct Snake { int hang; int lie; struct Snake *next; }; struct Snake *head=NULL; struct Snake *tail=NULL; struct Snake food; int key; .
2021-11-17 00:08:01
241
原创 linux 进程操作
进程包含创建进程,等待进程,进程标识符,进程退出 创建进程 :fork()函数创建进程,使用成功后fork返回两次,返回值为0的时候是子进程,返回值大于0是父进程,返回值大于0的时候返回值等于子进程的pid号,调用失败返回-1。 用getpid();获取当前进程的id号,getppid()获取父进程的进程id。 如果A进程创建了B进程,那么A是B的父进程,B是A的子进程。 pid=0:称为交换进程 作用 进程调度。 pid=1 : init进程 作用系统初始化。 fork创建进程之后代码段子夫共.
2021-12-07 15:10:30
500
原创 linux 文件操作
函数 open write read lseek close open 打开函数 打开成功返回值一个非负整数 打开失败返回-1 用法open(文件路径/文件明,文件打开方式,文件权限); write 写入函数 打开成功返回值一个非负整数 打开失败返回-1 用法write(写入那个文件/文件文件描述符,写入那个文件,写多大); read 读取函数 打开成功返回值一个非负整数 打开失败返回-1 用法read(读取那个文件/文件文件描述符,读到那个文件,读多大); lseek移动光标 用法...
2021-11-23 22:15:55
222
原创 linux 初学文件
文件操作提供API 打开 open 读/写 read/write 光标定位lseek 关闭 close open的两种写法 open("文件路径","文件操作方式"); open("文件路径","文件操作方式","文件权限"); 注意文件描述符 操作之后open会返回一个数 如果成功返回的数是整数如果失败返回一个负数 ...
2021-11-17 23:04:30
229
原创 Linux 使用尾插法实现 链表A每个节点存放一个新的链表B1B2,B3,B4,B5的头结点。场景:一个年级相当链表A该年级5个班,每个班5个人,做学生管理系统源代码
#include <stdio.h> #include <stdlib.h> struct Student { int yuwen; int shuxue; int yingyu; int ban; int ji; int zf; struct Student *next; }; struct Class { struct Student *xnext; struct Class *next; }; void wellcome() { printf("**.
2021-11-12 22:30:21
1144
1
原创 linux 创建动态链表尾插法两种方法
#include <stdio.h> #include <stdlib.h> struct Test { int data; struct Test *next; }; void printflink(struct Test *head) { struct Test *p=head; while(p != NULL){ printf("%d ",p->data); p=p->next; } putchar('\n'); } struct.
2021-11-12 22:20:39
1191
原创 linux 下创建动态链表头插法两种方法
#include <stdio.h> #include <stdlib.h> struct Test { int data; struct Test *next; }; void printflink(struct Test *head) { struct Test *p=head; while(p != NULL){ printf("%d ",p->data); p=p->next; } putchar('\n'); } struct Te.
2021-11-12 22:18:37
304
原创 linux 下删除一个链表
#include <stdio.h> #include <stdlib.h> struct Test { int data; struct Test *next; }; void printflink(struct Test *head) { struct Test *p=head; while(p != NULL){ printf("%d ",p->data); p=p->next; } putchar('\n'); } struct.
2021-11-12 22:15:02
160
原创 linux 链表改动值
#include <stdio.h> #include <stdlib.h> struct Test { int data; struct Test *next; }; void printflink(struct Test *head) { struct Test *p=head; while(p != NULL){ printf("%d ",p->data); p=p->next; } putchar('\n'); } int zh.
2021-11-12 22:10:58
108
原创 linux 下尾插法
#include <stdio.h> #include <stdlib.h> struct Test { int data; struct Test *next; }; void printflink(struct Test *head) { struct Test *p=head; while(p != NULL){ printf("%d ",p->data); p=p->next; } putchar('\n'); } struct Te.
2021-11-12 22:07:24
908
原创 linux 下头插法
#include <stdio.h> #include <stdlib.h> struct Test { int data; struct Test *next; }; void printflink(struct Test *head) { struct Test *p=head; while(p != NULL){ printf("%d ",p->data); p=p->next; } putchar('\n'); } struct Tes.
2021-11-12 22:04:01
873
原创 链表初始
打印链表代码 链表是一个连接一个可以任意增删 打印链表代码 #include <stdio.h> struct Test { int data; struct Test *next; }; /* void printflink(struct Test *head) { while(1){ if(head != NULL){ printf("%d ",head->data); //这是第一种方法 ...
2021-11-07 21:20:09
140
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅