摘要: 1 #include <io_utils.h> 2 3 typedef enum FileFormat { 4 PNG, JPEG = 10, BMP = 20, UNKNOWN 5 } FileFormat; 6 7 FileFormat GuessFormat(char *file_path) 阅读全文
posted @ 2023-02-11 20:11 泥古拉斯赵四 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 1 #include <io_utils.h> 2 3 #define OP_PRINT_INT 0 4 #define OP_PRINT_DOUBLE 1 5 #define OP_PRINT_STRING 2 6 7 typedef union Operand { 8 int int_opera 阅读全文
posted @ 2023-02-11 20:08 泥古拉斯赵四 阅读(33) 评论(0) 推荐(0) 编辑
摘要: 1 #include <io_utils.h> 2 3 int IsBigEndian() { 4 union { 5 char c[2]; 6 short s; 7 } value = {.s=0x100}; 8 9 return value.c[0] == 1; 10 } 11 12 int I 阅读全文
posted @ 2023-02-11 20:07 泥古拉斯赵四 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 怎么对齐的? 是对齐他占用内存的倍数, 看下面的代码 int main() { typedef struct Person { char *name; int age; char *id; } Person; struct Person person = {.name="bennyhuo", .id 阅读全文
posted @ 2023-02-05 08:47 泥古拉斯赵四 阅读(40) 评论(0) 推荐(0) 编辑
摘要: 定义一个结构体 struct Company { char *name; char *id; char *location;} 初始化 1 struct Company company = {.name="imooc", .id="1212121"}; 怎么省略struct呢 声明的时候可以这么声明 阅读全文
posted @ 2023-02-05 08:00 泥古拉斯赵四 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 1 #include <stdio.h> 2 #include "io_utils.h" 3 #include <stdlib.h> 4 #include <time.h> 5 6 void SwapInt(int *a, int *b) { 7 int temp = *a; 8 *a = *b; 阅读全文
posted @ 2023-02-04 17:09 泥古拉斯赵四 阅读(4) 评论(1) 推荐(0) 编辑
摘要: 第一版: 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include <io_utils.h> 5 6 void Swap(int a,int b){ 7 int temp=a; 8 a=b; 9 b=tem 阅读全文
posted @ 2023-02-04 16:35 泥古拉斯赵四 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <io_utils.h> 4 5 // 1 6 int *(f1(int, double)); 7 8 // 2 9 int (*f2)(int, double); 10 11 // 3 12 阅读全文
posted @ 2023-02-04 16:03 泥古拉斯赵四 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 动态内存分配的函数 *ptr = malloc(sizeof(int) * length);动态分配内存 players = calloc(PLAYER_COUNT, sizeof(int));会清空动态分配的内存 players = realloc(players, PLAYER_COUNT * 阅读全文
posted @ 2023-02-04 15:43 泥古拉斯赵四 阅读(24) 评论(0) 推荐(0) 编辑
摘要: RAZ是EAX的高32位,RDX是EDX的高32位。 低32位清零,高32位也会清零 阅读全文
posted @ 2023-02-04 14:37 泥古拉斯赵四 阅读(23) 评论(0) 推荐(0) 编辑