2021年4月2日

摘要: 1. 初始化一个双向链表。 2. 具体方法插入,每个节点可以存在如下结构: struct node_each node{ int data; struct node_each *prev; struct node_each *next; }; A. 头插入法 代码思路: { D->next = he 阅读全文
posted @ 2021-04-02 11:16 real-watson 阅读(1020) 评论(0) 推荐(0) 编辑
 

2021年3月31日

摘要: 最精简版本 int check_data(int *array, int n) { while(n--) if (*array++ != 0x00) return 0; return 1; } 返回1 array数组全零,否则正常非全零。 int check_data(int *array) { w 阅读全文
posted @ 2021-03-31 19:07 real-watson 阅读(405) 评论(0) 推荐(0) 编辑
 
摘要: 上题目,下面上一个分析: n = 10, i = 9, pa[6] = pa[6] + pa[9]; ........ 过程中出现pa[6] + pa[6],此时的pa[6] != 7,而是现内存下的值pa[6] = 0 + 9 + 8 + 7 = 24 pa[6] = pa[6] + pa[6] 阅读全文
posted @ 2021-03-31 15:34 real-watson 阅读(57) 评论(0) 推荐(0) 编辑
 

2021年3月30日

摘要: 最基础的二分法算法C int search_digit(int *num,int cnt,int target) { int first = 0; int last = cnt - 1; int mid;/* |x x x x o| -> |x x m x o| x m x */ while(fir 阅读全文
posted @ 2021-03-30 14:41 real-watson 阅读(67) 评论(0) 推荐(0) 编辑
 
摘要: strcpy和strncpy摘于linux 内核源码的/lib/string.c char *self_strcpy(char *dest, const char *src) { char *tmp = dest; while ((*dest++ = *src++) != '\0') /* noth 阅读全文
posted @ 2021-03-30 12:01 real-watson 阅读(461) 评论(0) 推荐(0) 编辑
 

2021年3月29日

摘要: 上代码直接研究: int main() { int *heap_d; int *heap_e; int *heap_f; heap_d = (int *)malloc(10); heap_e = (int *)malloc(10); printf("The d address is %p\n",he 阅读全文
posted @ 2021-03-29 14:45 real-watson 阅读(377) 评论(0) 推荐(0) 编辑
 
摘要: 一份代码可以知道具体方式和原理: int main() { int stack_a; int stack_b; static int static_c; static int static_d; int *heap_e; int *heap_f; heap_e = (int *)malloc(10) 阅读全文
posted @ 2021-03-29 14:36 real-watson 阅读(1683) 评论(0) 推荐(0) 编辑
 

2021年3月17日

摘要: 1. 利用open打开USB转串口的设备遇到打开异常。 若用vs调试代码,则需要usermod 对应归到watson组下,因为watson这个是vs ssh连接虚拟机的用户名,若用root则无法使用改串口。 阅读全文
posted @ 2021-03-17 09:45 real-watson 阅读(99) 评论(0) 推荐(0) 编辑
 

2021年3月10日

摘要: 1 . const char *ptr 从char *ptr 可以理解为指向字符常量的指针,ptr是一个指向char *的常量,*ptr的值为const,不能修改。 2. char const *ptr 同上 3. char * const ptr 定义一个指向字符的指针常数,不能修改指针,但可以修 阅读全文
posted @ 2021-03-10 17:10 real-watson 阅读(854) 评论(0) 推荐(0) 编辑
 

2021年2月24日

摘要: 1. 什么是哈希表 散列表(Hash table,也叫哈希表),是根据关键码值(Key value)而直接进行访问的数据结构。也就是说,它通过把关键码值映射到表中一个位置来访问记录,以加快查找的速度。这个映射函数叫做散列函数,存放记录的数组叫做散列表。 摘于百度百科 通俗可以理解: 如何把13 18 阅读全文
posted @ 2021-02-24 10:49 real-watson 阅读(86) 评论(0) 推荐(0) 编辑