- 博客(9)
- 资源 (1)
- 收藏
- 关注
原创 第1层——C基本概念
从本篇文章开始,我们的登塔之路正式开始,也是C语言系列的开始,我将从最基础的语法写起,由浅入深,最终达到熟练掌握的目的。刚开始学C,你可以先在 window系统 上随便找个编译器,就可以写代码了,本人使用的编译器为vs2019,如果你想安装使用,可以去看这篇博客:https://blog.youkuaiyun.com/qq_36556893/article/details/88603729废话不多说,让...
2019-07-17 07:42:46
199
原创 计算参数的奇偶性
/***计算参数的奇偶性,如果参数中有奇数个1,则返回1;如果有偶数个1,则返回0*/int odd_even_check(unsigned int x){ int val = 0; /*若是奇数,val的最低位为1,(只看val和x的最低位即可)*/ while (x != 0) { val ^= x; x >>= 1; } return val...
2019-07-13 16:12:12
384
原创 c语言实现双向链表的插入
/*** 把一个新值插入到双向链表中,rootp是一个指向根节点的指针** value是需要插入的新值** 返回值:如果链表原先已经存在这个值,返回0** 如果为新值分配内存失败,返回-1** 如果新值插入成功,返回1*/#include <stdio.h>#include <stdlib.h>typedef struct NODE { struct...
2019-07-10 22:01:46
1844
原创 语言实现有序单链表的插入
/***有序单链表的插入,函数参数为指向链表第一个节点的指针及要插入的值*/#include <stdio.h>#include <stdlib.h>#define FALSE 0#define TRUE 1typedef struct NODE { struct NODE* link; int value;} Node;intsll_...
2019-07-10 22:00:56
517
原创 在字符串s1中查找字符串s2最右出现的位置,并返回一个指向该位置的指针
/***在字符串s1中查找字符串s2最右出现的位置,并返回一个指向该位置的指针*/#include <string.h>#include <stdio.h>char*my_strrstr(char const* s1, char const* s2){ char* current; char* last; last = NULL; if (*s2...
2019-07-09 22:40:36
1413
原创 用动态内存制作一个字符串的拷贝
/***用动态内存制作一个字符串的拷贝*/#include <string.h>#include <stdlib.h>char* strdup(char const* string){ char* new_string; /* **请求足够长的内存,用于存储字符串NUL */ new_string = malloc(strlen(string)...
2019-07-09 22:39:43
218
原创 c语言实现字符串反转
话不多说,直接上代码:时间复杂度是O(n)void reverse(char s[]){ int i, j; //下标j、i分别从前面和后面同时向中间靠近 char temp; j = 0; for (i = 0; s[i] != '\0'; i++) //排除'\0' ; if (s[--i] == '\n') //排除'\n' i--; while (j &l...
2019-07-06 23:05:18
933
原创 c语言中的转义字符
转义字符小细节如果\后面紧跟的字符不在以下指定的字符中,则行为是未定义的。eg:#include <stdio.h>main(){ printf("hello world\y"); printf("hello world\7"); printf("hello world\?");}以上代码的执行结果与具体的编译器相关,比如在vs2019版上是:(且有一声短蜂...
2019-07-06 22:56:32
173
原创 python爬图
import requests,re,os,threadingfrom lxml import etreefrom queue import Queuefrom urllib import requestclass Producer(threading.Thread): headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; ...
2019-01-05 13:29:43
144
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人