- 博客(43)
- 收藏
- 关注
![](https://csdnimg.cn/release/blogv2/dist/pc/img/listFixedTop.png)
原创 【Linux】静态库与动态库的制作
目录静态库的制作及使用步骤动态库的制作及使用步骤1. 静态库的制作及使用步骤1.1 生成与地址有关的 .o 文件# gcc -c *.c -o *.oeg: gcc -c calc.c -o calc.o1.2 生成静态库# ar -cr lib库名.a *.oeg: ar -cr libcalc.a *.o1.3使用静态库# gcc test.c -o test -L./lib -l库名 (ps: 库名通过 “掐头去尾留中央” 的方式获取)eg:.
2018-09-17 11:19:19
212
![](https://csdnimg.cn/release/blogv2/dist/pc/img/listFixedTop.png)
原创 【数据结构】浅析时间复杂度与空间复杂度
衡量算法效率的标准:时间复杂度和空间复杂度。 通俗地来讲,时间复杂度就是一个程序要被执行的次数,它是一个近似值,而不是执行的时间。空间复杂度,是程序执行过程中所占用的最大内存。 接下来通过两段代码来说明下如何计算一个程序的时间复杂度以及空间复杂度:int SumMemory(int n) // 时间复杂度:共执行2n+5次,用大O表示法记为O(n);空间复杂度:4n+12字节,用大O表示法...
2018-06-07 20:10:50
881
![](https://csdnimg.cn/release/blogv2/dist/pc/img/listFixedTop.png)
原创 【C】库函数之 atoi
Convert string to integer# include <stdlib.h>int atoi (const char * str); Parses the C-string str interpreting its content as an integral number, which is returned as a value of type int. Th...
2018-05-22 17:59:01
771
![](https://csdnimg.cn/release/blogv2/dist/pc/img/listFixedTop.png)
原创 【C】判断当前系统是大端还是小端
1、大小端介绍 实际上,大小端指的是数据在内存中的存储模式。大端字节序(存储模式):一个数据的低位字节序的内容存放在高地址处,而高位字节序的内容存放在低地址处。小端字节序(存储模式):一个数据的高位字节序的内容存放在高地址处,而低位字节序的内容存放在低地址处。2、判断当前系统是大端还是小端 int a = 1; 假设有一个数字为 a = 1,分别画出 a 在大端和小端两种情况下的内存分布。a...
2018-04-30 21:11:08
8505
4
![](https://csdnimg.cn/release/blogv2/dist/pc/img/listFixedTop.png)
原创 【C】浅析 #define 宏和函数的区别
1. 执行速度(效率);2. 调试的难易程度;3. 是否会增加代码长度;4. 是否可以传入参数类型;5. 是否带来副作用。
2018-04-30 15:13:35
17748
![](https://csdnimg.cn/release/blogv2/dist/pc/img/listFixedTop.png)
原创 【C】折半(二分)查找
折半查找也称为二分查找,是一种在有序数组中查找某一特定元素的搜索算法。其优点是查找速度快,缺点是所要查找的数据必须在有序序列中。1、基本思想假设有一个升序排列的数组 arr,在该数组中查找元素 key。首先找出该数组中最中间的元素,然后将最中间的元素mid 与所要查找的元素 key 进行比较,如果相等则返回该元素的下标。如果 mid > key,那么在 mid 左边的区间去查找...
2018-03-28 23:45:41
5474
2
原创 【Linux】进程间关系和守护进程
终端终端是所有输入/输出设备的总称,如 字符终端、伪终端、图形终端、网络终端等。在 UNIX 系统中,用户通过终端登录系统后得到一个 Shell 进程,这个终端称为 Shell 进程的控制终端。简单来说,一个 Linux 系统启动,大概需要经历以下步骤:init --->fork ---> exec ---> getty ---> login ---&...
2018-09-17 11:26:56
229
原创 【C】库函数之 strncmp
目录1. Compare characters of two strings2. 源代码3. 输出结果1. Compare characters of two strings#include <string.h>int strncmp ( const char * str1, const char * str2, size_t num );Compares up tonumcharacters of the C stringstr1to those of t...
2018-05-17 19:27:11
489
原创 【C】库函数之 strncat
目录1. Append characters from string2. 源代码3. 输出结果1. Append characters from string#include <string.h>char * strncat ( char * destination, const char * source, size_t num );Appends the firstnumcharacters ofsourcetodestination, plus a ...
2018-05-17 19:19:29
256
原创 【C】库函数之 strncpy
目录1. Copy characters from string2. 源代码3. 输出结果1. Copy characters from string#include <string.h>char * strncpy ( char * destination, const char * source, size_t num );Copies the firstnumcharacters ofsourcetodestination. If the end o...
2018-05-17 19:11:12
279
原创 【C】库函数之 memmove
目录1. Move block of memory2. 源代码3. 输出结果1. Move block of memory#include <string.h>void * memmove ( void * destination, const void * source, size_t num );Copies the values of num bytes from the location pointed by source to the memory blo
2018-05-17 19:02:21
235
原创 【C】库函数之 memcpy
目录1. Copy block of memory2. 源代码3. 输出结果1. Copy block of memory#include <string.h>void * memcpy ( void * destination, const void * source, size_t num );Copies the values of num bytes from the location pointed to by source directly to the
2018-05-17 18:52:07
258
原创 【C】库函数之 strchr
目录1. Locate first occurrence of character in string2. 源代码3. 输出结果1. Locate first occurrence of character in string#include <string.h>char * strchr ( const char * str, int character );Returns a pointer to the first occurrence ofcharacte.
2018-05-17 18:42:40
169
原创 【C】库函数之 strcmp
1. Compare two strings#include <string.h>int strcmp ( const char * str1, const char * str2 );Compares the C stringstr1to the C stringstr2.This function starts comparing the first character of each string. If they are equal to each other...
2018-05-17 18:24:51
567
原创 【C】库函数之 strstr
目录1. Locate substring2. 算法分析3. 源代码4. 输出结果1. Locate substring#include <string.h>char * strstr ( const char * str1, const char * str2 );Returns a pointer to the first occurrence of str2 in str1, or a null pointer if str2 is not part of
2018-05-03 14:07:45
239
原创 【C】库函数之 pow
目录1. Raise to power2. 两种实现2.1递归2.2 迭代3. 测试函数4. 输出结果1. Raise to power#include <math.h>double pow(double base, double exponent);Returnsbaseraised to the powerexponent:base ^ exponent以上是cplusplus 对 pow 函数的介绍,可以看出该函数用来计算 ba...
2018-04-25 19:26:48
1396
原创 【C】库函数之 strlen
Get string length # include <string.h> Returns the length of the C string. The length of a C string is determined by the terminating null-character: A c string is as long as the number of cha...
2018-04-20 14:27:02
855
原创 【C】库函数之 strcat
Concatenate strings# include <string.h> Appends a copy of the source string to the destination string. The terminating null character indestinationis overwritten by the first character of sou...
2018-04-20 13:37:40
243
原创 【C】库函数之 strcpy
Copy string # include <string.h> Copies the C string pointed by source into the array pointed by destination, including the terminating null character (and stopping at that point). To avoid o...
2018-04-20 11:13:36
312
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人