
C
NH4L
love
展开
-
C语言实现读取elf文件某section
C语言实现读取elf文件某section这方面资料很少,所有结合相关信息写出代码代码#include <stdio.h>#include <memory.h>#include <stddef.h>#include <stdlib.h>#include <memory.h>#include <string.h>#include <elf.h>int main(int argc, char* argv[])原创 2021-01-24 12:40:16 · 3448 阅读 · 0 评论 -
C语言实现创建有序链表
C语言实现创建有序链表节点结构//链表struct node{ int data; node *next;};插入函数(有序)//链表中插入节点(保持链表升序关系)node *insert(node *head, node *p) {//头节点 ,p指向要插入的节点 node *p1, *p2; if (head == NULL) { //链表为空(head=NULL) head = p; p->next = NULL; return head; } if (原创 2021-01-24 11:48:14 · 2996 阅读 · 1 评论 -
C语言实现删除链表所有节点空间
C语言实现删除链表所有节点空间节点结构struct node{ int data; node *next;};删除函数//释放链表节点空间void delete_chain(node *head){ node *p1; while (head) { p1 = head; head = head->next; free(p1); }}原创 2021-01-24 11:45:40 · 2395 阅读 · 0 评论 -
C语言实现有序链表中插入新的节点
C语言实现有序链表中插入新的节点节点结构struct node{ int data; node *next;};插入函数(保持有序)//链表中插入节点(保持链表升序关系)node *insert(node *head, node *p) {//头节点 ,p指向要插入的节点 node *p1, *p2; if (head == NULL) { //链表为空(head=NULL) head = p; p->next = NULL; return head; } if原创 2021-01-24 11:42:28 · 3112 阅读 · 1 评论 -
C语言实现删除链表的一个节点
C语言实现删除链表的一个节点节点表示struct node{ int data; node *next;};删除函数//删除链表的一个节点node *delete_node(node *head, int data){ node *p1, *p2; if (head == NULL) {//链表为空(head=NULL) printf("链表节点为空!\n"); return 0; } if (head->data == data) {//链表非空,删除表头。原创 2021-01-24 11:39:12 · 2744 阅读 · 0 评论 -
C语言实现英文句子单词提取并分离
C语言实现英文句子单词提取并分离将英文句子中的所有单词分离出来并输出分隔符判断函数static int isdelimeter(char *di, char ch) { while (*di) { if (ch == *di) return 1; else di++; } return 0;}提取单词函数char *get_token(const char *buf, char *di) { static int pos = 0; static char toke原创 2021-01-23 21:31:41 · 8286 阅读 · 2 评论 -
C语言实现整数转化为字符串
C语言实现整数转化为字符串转化函数整数转化为字符串char *int_to_str(int x, char *str) { char ch, *p; int sign = 0, r; p = str; if (x < 0) { //处理负数 sign = 1; x = -x; } while (x > 0){ //取余实现倒序 r = x % 10; x = x / 10; *p = 48 + r; p++; } if (sign =原创 2021-01-23 20:38:17 · 3420 阅读 · 1 评论 -
C语言实现字符串逆序
C语言实现字符串逆序字符数组方式实现前后字符交换void str_reverse_arr(char *s) { char t; int low = 0, high = strlen(s) - 1; while (low < high) { t = s[low]; s[low] = s[high]; s[high] = t; low++; high--; }}指针方式实现前后指针交换void str_reverse_point(char *s) { char原创 2021-01-23 19:34:09 · 1897 阅读 · 0 评论 -
C语言编译生成elf可执行文件(编译运行)
C语言编译生成elf可执行文件OS:deepin 15gcc -V:(Debian 6.3.0-18+deb9u1) 6.3.0 20170516gcc -o hello hello.cgcc hello.c -v -o hello终端输入即可。./hello原创 2020-05-15 23:20:39 · 4102 阅读 · 0 评论