摘要:
1. 基于数组的顺序队列 #include <stdio.h> #include <stdbool.h> #define MAX_SIZE 100 // 定义队列结构 typedef struct { int data[MAX_SIZE]; // 存储数据的数组 int front; // 队头指针 阅读全文
posted @ 2025-03-07 14:22
lordshang
阅读(8)
评论(0)
推荐(0)
摘要:
1. 基于数组的栈实现 #include <stdio.h> #include <stdlib.h> #include <stdbool.h> // 定义栈的最大容量 #define MAX_SIZE 100 // 定义栈结构 typedef struct { int data[MAX_SIZE]; 阅读全文
posted @ 2025-03-07 14:09
lordshang
阅读(8)
评论(0)
推荐(0)
摘要:
1. 基本用法 #include <stdio.h> // 基本类型的别名 typedef int Integer; typedef unsigned long ulong; typedef char* String; int main() { // 使用类型别名声明变量 Integer num = 阅读全文
posted @ 2025-03-07 11:11
lordshang
阅读(6)
评论(0)
推荐(0)
摘要:
C语言基础知识详解 让我们系统地学习C语言的基础知识。 1. 基本数据类型 #include <stdio.h> int main() { // 整数类型 char c = 'A'; // 1字节,-128到127 unsigned char uc = 255; // 1字节,0到255 short 阅读全文
posted @ 2025-03-07 10:56
lordshang
阅读(26)
评论(0)
推荐(0)
摘要:
#include <stdio.h> #include <stdlib.h> #include <string.h> // 定义动态数组结构体 typedef struct { int* data; // 数据存储区域 size_t size; // 当前元素个数 size_t capacity; 阅读全文
posted @ 2025-03-07 10:47
lordshang
阅读(32)
评论(0)
推荐(0)
摘要:
1. 结构体的基本概念 结构体是一种用户自定义的数据类型,它可以包含多个不同类型的变量,这些变量称为结构体的成员。 2. 结构体的定义 struct 结构体名 { 成员类型1 成员名1; 成员类型2 成员名2; // ...更多成员 }; 示例: struct Student { int id; c 阅读全文
posted @ 2025-03-07 09:18
lordshang
阅读(4)
评论(0)
推荐(0)