随笔分类 -  C语言

摘要:定义 union example{ struct { short int x; short int y; } in; short int a; short int b; } e; union中成员包括 结构体成员变量in{short int x; short int y} sizeof(in) = 阅读全文
posted @ 2023-02-03 09:25 dctwan 阅读(192) 评论(0) 推荐(0) 编辑
摘要:辗转相除法求最大公约数 举例:24,18,最大公约数为6 24 / 18 = 1 ... 6 18 / 6 = 3 ... 0 当余数为0时,除数即为最大公约数 两数之积除最大公约数即为最小公倍数 实现代码如下 #include <stdio.h> #include <stdlib.h> int m 阅读全文
posted @ 2023-01-28 16:57 dctwan 阅读(18) 评论(0) 推荐(0) 编辑
摘要:如果一个表达式中的两个操作数具有相同的优先级,那么它们的结合律(associativity)决定它们的组合方式是从左到右或是从右到左 C语言运算符优先级及结合性如下图所示 犯过的错误 *p++ 等价于 *(p++) 具体错误代码如下 void preOrder(struct TreeNode *ro 阅读全文
posted @ 2023-01-04 14:12 dctwan 阅读(252) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示