上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 46 下一页

2020年3月8日

c语言实现队列

摘要: 用数组或者链表实现队列,先进先出 queue.h // // Created by gxf on 2020/3/8. // #ifndef UNTITLED_QUEUE_H #define UNTITLED_QUEUE_H void initQueue(); void enqueue(int dat 阅读全文

posted @ 2020-03-08 19:41 luckygxf 阅读(881) 评论(0) 推荐(0) 编辑

c 链表

摘要: list.h // // Created by gxf on 2020/3/8. // #ifndef UNTITLED_LINKLIST_H #define UNTITLED_LINKLIST_H typedef struct ListNodeS { int data; struct ListNo 阅读全文

posted @ 2020-03-08 11:48 luckygxf 阅读(123) 评论(0) 推荐(0) 编辑

c assert函数

摘要: 条件为false,调用abort函数退出进程,在线程中执行也会导致进程退出 // // Created by gxf on 2020/3/8. // #include "linklist.h" #include <assert.h> #include <stdio.h> #include <stdl 阅读全文

posted @ 2020-03-08 11:05 luckygxf 阅读(257) 评论(0) 推荐(0) 编辑

2020年3月4日

memmove and memcpy demo

摘要: memmove内存有重叠,保证源字符串被覆盖之前,拷贝到目的川 memcpy不保证 最好用memmove #include <stdio.h> #include <stdlib.h> #include <string.h> #include <pthread.h> int main() { char 阅读全文

posted @ 2020-03-04 00:37 luckygxf 阅读(177) 评论(0) 推荐(0) 编辑

c atoi demo

摘要: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <pthread.h> int main() { char *ns = "124142"; char *ns1 = "324241324"; printf("%d\ 阅读全文

posted @ 2020-03-04 00:29 luckygxf 阅读(162) 评论(0) 推荐(0) 编辑

c strsep函数demo

摘要: 在string.h中,分割字符串 #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char date[50] = "2019-10-1"; char delim[2] = "-"; char *s = s 阅读全文

posted @ 2020-03-04 00:23 luckygxf 阅读(677) 评论(0) 推荐(0) 编辑

2020年3月3日

c 可变参数demo

摘要: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdarg.h> int average(int num, ...); int main() { int averageRes = average(3, 1, 阅读全文

posted @ 2020-03-03 00:25 luckygxf 阅读(108) 评论(0) 推荐(0) 编辑

2020年3月1日

c 结构体最后一个成员使用长度为0数组

摘要: 变长数组,不用指针,可以只分配一次内存,释放一次内存,方便内存管理 demo.c #include <stdio.h> #include <stdlib.h> #include <string.h> struct demo { char ch1; char ch2; char str[0]; }; 阅读全文

posted @ 2020-03-01 17:58 luckygxf 阅读(516) 评论(0) 推荐(0) 编辑

c gdb demo

摘要: #include <stdio.h> void test_core1() { int i = 0; scanf("%d", i); } void test_core2() { char *name = "guanxianseng"; *name = 0; } int main() { test_co 阅读全文

posted @ 2020-03-01 16:57 luckygxf 阅读(116) 评论(0) 推荐(0) 编辑

c snprintf demo

摘要: 1. snprintf(char *buff, size_t len, char *format, ....),格式化字符串到buff中 #include <pthread.h> #include <stdio.h> #include <unistd.h> int data = 0; int mai 阅读全文

posted @ 2020-03-01 16:09 luckygxf 阅读(127) 评论(0) 推荐(0) 编辑

上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 46 下一页

导航