随笔分类 - C
摘要:#include <stdio.h> #include <stdint.h> #include <string.h> #include <unistd.h> #define clear() printf("\033[H\033[2J") int main(void) { uint32_t runni
阅读全文
摘要:#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/ioc
阅读全文
posted @ 2020-09-11 15:52
sfdevs
摘要:double add(double e1, double e2) { return e1 + e2; } double sub(double e1, double e2) { return e1 - e2; } double mul(double e1, double e2) { return e1
阅读全文
posted @ 2020-05-31 18:18
sfdevs
摘要:``` include include void error(int severity, ...) { va_list ap; va_start(ap, severity); for (;;) { char p = va_arg(ap, char ); if(!p) break; fprintf(s
阅读全文
posted @ 2020-05-14 15:25
sfdevs
摘要:递归的数学思想 递归是一种数学上分而自治的思想 递归将大型复杂问题转化为与原问题相同但规模较小的问题进行处理 递归需要有边界条件 当边界条件不满足时,递归继续进行 当边界条件满足时,递归停止 递归的数学表示 应用 斐波拉契数列递归解法 strlen递归解法 汉诺塔递归解法 全排列递归解法 去重全排列
阅读全文
摘要:``` // ASCII Peppa Pig by Milo Yip #include #include #include #define T double T c(T x, T y, T r) { return sqrt(x * x + y * y) - r; } T u(T x, T y, T t) { return x * cos(t) + y * sin(t); } T v(T x, T
阅读全文
摘要:``` #include /*整形转字符型*/ char * itoa(int value, char *string, int radix) { char tmp[33]; char *tp = tmp; int i; unsigned v; int sign; char *sp; if (radix > 36 || radix tmp) *sp++ = *--tp; *sp = 0; retu
阅读全文
摘要:```#define min(x,y) ({ \ typeof(x) _x = (x); \ typeof(y) _y = (y); \ (void) (&_x == &_y); \ _x _y ? _x : _y; })```
阅读全文
摘要:根据结果可以得出的信息 1. 结构体的地址和结构体中第一个元素的地址是相同的 2. Array在结构体中“不占空间” 实现的前提: 数组必须在结构体的最后,因为malloc的是整个结构体,如果数组不在最后,申请的空间会覆盖后面元素的空间
阅读全文