摘要: /* 权重的概念:在十进制数中,每个数字的位置决定了它的权重。例如,在数字 123 中,3 的权重是 3 * 10^0,2 的权重是 2 * 10^1,而 1 的权重是 1 * 10^2。 */ #include <stdio.h> #include <string.h> int MyAtoI(ch 阅读全文
posted @ 2024-08-23 20:19 北极甜虾哟 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 字符串相加,给定两个字符串形式的非负整数 num1 和num2 ,计算它们的和。 #include <stdio.h> #include <stdlib.h> #include <string.h> /** * 将两个字符串形式的非负整数相加,并返回结果字符串。 * * @param num1 第一 阅读全文
posted @ 2024-08-20 19:42 北极甜虾哟 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 打印倒三角形,底边长n作为参数输入,从键盘输入。 #include <stdio.h> int main(int argc, char const *argv[]) { int i, j, k, l, n; printf("请输入底边长: \n"); scanf("%d", &n); while ( 阅读全文
posted @ 2024-07-02 20:53 北极甜虾哟 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 分析C语言static关键字的作用 目录分析C语言static关键字的作用1.静态存储期(局部变量使用static时)2.静态全局变量3.static与函数一起使用 先来看一个案例 #include <stdio.h> int a=5; void show_val(void) { int b=3; 阅读全文
posted @ 2024-06-17 23:13 北极甜虾哟 阅读(20) 评论(0) 推荐(0) 编辑
摘要: Linux系统下C语言程序编译过程 C语言程序编译过程:源程序 预处理 编译 汇编 链接 可执行文件 1.预处理: 对源码进行简单的加工,GCC编译器会调用预处理器cpp对程序进行预处理,其实就是解释源程序中所有的预处理指令,如#include(文件包含)、#define(宏定义)、#if(条件编译 阅读全文
posted @ 2024-06-15 22:22 北极甜虾哟 阅读(16) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <arpa/inet.h> #include <unistd.h> #include <string.h> #include <sys/time.h> 阅读全文
posted @ 2024-06-13 21:52 北极甜虾哟 阅读(22) 评论(0) 推荐(1) 编辑
摘要: 从上图可以看到,线程被创建出来之后,都处于睡眠态,它们实际上是进入了条件量的等待队列中。而任务都被放入一个链表,被互斥锁保护起来。下面是线程池里面线程们的一生: \1. 被创建 \2. 写遗书(准备好退出处理函数,防止在持有一把锁的状态中死去) \3. 试图持有互斥锁(等待任务) \4. 判断是否有 阅读全文
posted @ 2024-06-12 20:28 北极甜虾哟 阅读(4) 评论(0) 推荐(0) 编辑
摘要: /************************************************************************************* * * @name : main * @function: 该函数利用http协议获取实时天气,并对响应包体进行json解析。 阅读全文
posted @ 2024-06-12 00:04 北极甜虾哟 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 服务端 #include <stdio.h> #include <errno.h> #include <netinet/ip.h> #include <arpa/inet.h> #include <sys/socket.h> #include <netinet/in.h> #include <net 阅读全文
posted @ 2024-06-09 23:58 北极甜虾哟 阅读(16) 评论(0) 推荐(0) 编辑
摘要: /** * author : 18312615416@163.com * @brief : 程序可以加入到一个多播组中并等待服务器发送数据包,并且程序还需要具有发送功能,如果收到数据包则把消息内容输出到终端 * @date : 2024/06/06 * @version : 1.0 * @note 阅读全文
posted @ 2024-06-06 10:18 北极甜虾哟 阅读(5) 评论(0) 推荐(0) 编辑