#include<stdio.h> #include<stdlib.h> struct node{ int date; struct node* next; }; struct node* creat(int info){ //创建一个节点 struct node* newnode=(struct node*)malloc(sizeof(struct node)); if(newnode==NULL){ printf("error\n"); exit(1); } newnode->date=info; newnode->next=NULL; return newnode; } void add(struct node** head, int info){ //在链尾接上节点 struct node* newnode=creat(info); if(*head==NULL){ *head =newnode; return; } struct node* now=*head;//当前指针不为空 while(now->next!=NULL){ now=now->next; } now->next=newnode; } void coutout(struct node* head){ //遍历链表输出 struct node* now=head; printf("following is the list:\n"); while(now!=NULL){ printf("%d ",now->date); now=now->next; } printf("\n"); } void freelist(struct node* head){ //释放内存 struct node* t; while(head!=NULL){ t=head; head=head->next; free(t); } } void insert(struct node* head,int k,int date){ //插入节点 if(head==NULL){ printf("empty\n"); return; } struct node* now=head; for(int i=1;i<k&&now!=NULL;i++){ now=now->next; } if(now==NULL){ printf("over the list\n"); return; } struct node* newnode=creat(date); newnode->next=now->next; now->next=newnode; } void deletenode(struct node** head,int k){ if(*head==NULL){ printf("the list is empty\n"); return; } struct node* now=*head; struct node* prev=NULL; for(int i=1;i<k&&now!=NULL;i++){ prev=now; now=now->next; } if(now==NULL){ printf("over the list\n"); return; } if(prev==NULL){ *head=now->next; }else{ prev->next=now->next; } free(now); } int main(){ struct node* head=NULL; int num; scanf("%d",&num); while(num--){ int t; scanf("%d",&t); add(&head,t); } coutout(head); freelist(head); }C语言链表2
张小明
前端开发工程师
使用Kotaemon构建城市公共服务智能应答系统
使用Kotaemon构建城市公共服务智能应答系统 在智慧城市加速推进的今天,市民对政务服务的期待早已超越“能办”,转向“好办、快办、主动办”。然而现实是:政策文件分散在数十个部门网站,办事流程动辄十几步,咨询热线永远…
8、从代码到内存:通用入门指南
从代码到内存:通用入门指南 1. 指针与数组在内存中的存储 在内存中,像 thinStringP (地址 0x01243040)和 wideStringP (地址 0x0124306C)这样的变量所存储的值仅 4 字节长,且不包含字符串数据。这是因为它们实际上是指向各自数组首字符的指针。例如, thinString…
14、游戏内存操作与代码注入技术解析
游戏内存操作与代码注入技术解析 1. 游戏内存保护与地址空间布局随机化 1.1 内存保护问题 在操作游戏内存时,如果改变原有的内存保护属性,游戏进程可能会出现 ACCESS_VIOLATION 异常并崩溃。例如,将内存保护从 PAGE_EXECUTE 改为 PAGE_READWRITE ,当内存未标记为可…
19、游戏中的控制流操纵与透视挂技术
游戏中的控制流操纵与透视挂技术 1. 编写 EndScene() 钩子 在游戏编程中,对 EndScene() 函数进行钩子操作非常有用。它能让你在一个完整的帧渲染之前进行拦截,从而在游戏循环中有效地执行自己的渲染代码。 EndScene() 函数在虚拟函数表(VF 表)中的索引为 42。以下是使…
Kotaemon离职面谈话术指南
Kotaemon:构建企业级智能对话系统的工程实践 在当今的企业数字化浪潮中,越来越多组织开始尝试将大模型技术应用于客户服务、内部知识管理和业务流程自动化。然而,许多项目在从PoC(概念验证)迈向生产部署时却频频受阻—…
Kotaemon能否支持中文全文检索?分词优化方案
Kotaemon能否支持中文全文检索?分词优化方案 在企业级智能问答系统日益普及的今天,一个关键问题浮出水面:当面对中文这种无空格分隔、语义高度依赖上下文的语言时,主流RAG框架是否真的能“读懂”我们的语言? 以Kotae…