随笔分类 - C语言入门练习
摘要:案例:记录用户得分的哈希表 注意 HASH_ADD里的name是结构体的字段,不是变量; 如果要确保哈希表每个键值对唯一,需要在添加时额外判断; #include <stdio.h> #include "uthash.h" #define MAX_NAME_LENGTH 20 // 用户和分数的哈希
阅读全文
摘要:#include <stdio.h> // 标准输入输出库 #include <string.h> // 字符串操作库 #include <ctype.h> // 字符处理库(如tolower, isdigit等) #include <stdbool.h> // 布尔类型支持 #include <s
阅读全文
摘要:#include <stdio.h> #include <stdbool.h> #include <limits.h> #include <stdlib.h> typedef struct Frame { int pageId; int visitNum; int accessTime; } Fra
阅读全文
摘要:Ctype库常用函数 ctype.h 头文件提供了一些函数,可用于测试和转换字符,这些函数主要用于检查字符的类型(如字母、数字、空白字符等)以及进行字符大小写转换。 检查字符类型 1. 十进制数字 int isdigit(int c) 2. 字母 int isalpha(int c) 3. 字母和数
阅读全文
摘要:Leecode 389. 找不同 1. 个人解法,使用哈希表映射 char findTheDifference(char* s, char* t) { // 第二种 构建哈希表 int table[26] = {0}; char res; int i = 0; while (s[i] != '\0'
阅读全文

浙公网安备 33010602011771号