当前位置: 首页 > news >正文

wordpress收费模板seo百度刷排名

wordpress收费模板,seo百度刷排名,怎么做代购上那个网站,揭阳市php网站开发找工作C语言-数据结构与算法 C语言基础 因为之前写算法都是用C,也有了些C基础,变量常量数据类型就跳过去吧。 首先是环境,学C时候用Clion,C语言也用它写吧~ 新建项目,选C执行文件,语言标准。。。就先默认C99吧…

C语言-数据结构与算法

C语言基础

因为之前写算法都是用C++,也有了些C++基础,变量常量数据类型就跳过去吧。

首先是环境,学C++时候用Clion,C语言也用它写吧~

新建项目,选C执行文件,语言标准。。。就先默认C99吧,反正是测试环境,应该问题不大

image-202308231731119510

直接运行一手

image-202308213173157961

嗯。。JB家的新UI。。真是。。。。。。。一言难尽

指针

好像最开始学C++开始,就一直没玩明白指针,毕竟一用数组链表就直接上STL库,也不太用得到指针

新的学习阶段,从指针开始!

1

#include <stdio.h>int main() {int a = 123;int * p = &a;printf("a:%d\n", a);printf("*p:%d\n", *p);printf("a的地址:%p\n", &a);printf("指针p指向的地址:%p\n", p);printf("指针p自身的地址:%p\n", &p);return 0;
}

image-202308215144721227

如果你的Clion输出乱码,按照以下顺序配置即可解决:

文件——设置——编辑器——文件编码,都改成UTF-8

image-202310825145205006

然后点击确定,回到代码页面,点击最下方UTF-8,选择GBK

1

再点击转换,重新运行即可解决

image-202302825145348845

结构体

使用typedef可以给结构体指定别名

#include <stdio.h>
#include <string.h>
typedef struct Book {char isbn[50];char name[20];int price;
}B;int main() {// 声明struct Book b;// 初始化b.price = 20;strcpy(b.name, "笑场");// 声明同时初始化struct Book a = {"122333123", "冷玚", 45};B c = {"122334233123", "乡土中国", 65};return 0;
}

属性声明的同时进行变量声明

struct Book {char isbn[50];char name[20];int price;
} stu;

属性声明的同时进行变量声明及初始化

struct Book {char isbn[50];char name[20];int price;
} stu = {"1531", "宇宙超度指南", 46};

如果只需要声明一次,可以省略结构体标记

struct {char isbn[50];char name[20];int price;
} stu = {"1531", "宇宙超度指南", 46};

链表

image-20230906083438591

链表结构体定义

typedef struct node {int data;struct node *next;
} node;

image-20230906090559534

创建单链表

node *createList() {node *head = (node *) malloc(sizeof(node));if (head == NULL) return NULL; // 若内存申请失败,指针会为空(一般情况下不会申请失败)head->data = 0;head->next = NULL;return head;
}

头结点:头指针指向的结点

首元结点:头结点后面的第一个结点

插入新结点

image-20230906093917082

插入新结点的时候要注意,一定先抓住后边的那个结点,再修改前边的那个结点的指针指向。

(必须时刻有指针指向后边结点的位置,不能让后边的结点丢了😉)

删除指定位置结点

node *deleteNode(node *head, int pos) {node *currentNode = head;// 如果插入位置比链表长,为非法操作。(头结点data存储链表长度)if (pos > currentNode->data) return NULL;for (int i = 0; i < pos; ++i) {currentNode = currentNode->next;}node *temp = currentNode->next;currentNode->next = currentNode->next->next;// 释放内存free(temp);// 链表长度减一head->data--;return head;
}

输出链表

void printList(node *head) {// 跳过头结点数据node *currentNode = head->next;while (currentNode != NULL) {if (currentNode->next == NULL) {// 是最后一个结点的话不输出箭头printf("%d", currentNode->data);} else {printf("%d->", currentNode->data);}currentNode = currentNode->next;}printf("\n");
}

测试链表相关方法

#include <stdio.h>
#include <stdlib.h>typedef struct node {int data;struct node *next;
} node;// 创建单链表
node *createList() {node *head = (node *) malloc(sizeof(node));if (head == NULL) return NULL;head->data = 0;head->next = NULL;return head;
}// 插入新结点
node *insertNode(node *head, int data, int pos) {node *currentNode = head;// 如果插入位置比链表长,为非法操作。(头结点data存储链表长度)if (pos > currentNode->data) return NULL;for (int i = 0; i < pos; ++i) {currentNode = currentNode->next;}// 新建结点node *newNode = (node *) malloc(sizeof(node));newNode->data = data;// 牵住当前位置下一个结点newNode->next = currentNode->next;// 牵住当前位置上一个结点currentNode->next = newNode;// 链表长度加一head->data++;return head;
}// 删除结点
node *deleteNode(node *head, int pos) {node *currentNode = head;// 如果插入位置比链表长,为非法操作。(头结点data存储链表长度)if (pos > currentNode->data) return NULL;for (int i = 0; i < pos; ++i) {currentNode = currentNode->next;}node *temp = currentNode->next;currentNode->next = currentNode->next->next;// 释放内存free(temp);// 链表长度减一head->data--;return head;
}// 遍历列表
void printList(node *head) {// 跳过头结点数据node *currentNode = head->next;while (currentNode != NULL) {if (currentNode->next == NULL) {// 是最后一个结点的话不输出箭头printf("%d", currentNode->data);} else {printf("%d->", currentNode->data);}currentNode = currentNode->next;}printf("\n");
}int main() {node *l = createList();insertNode(l, 1, 0);insertNode(l, 2, 1);insertNode(l, 3, 0);printList(l);deleteNode(l, 1);printList(l);return 0;
}

image-20230906110134438

http://www.ds6.com.cn/news/101249.html

相关文章:

  • 布吉建网站html网页制作案例
  • 定制应用软件有哪些seo建站网络公司
  • 腾讯风铃怎么做网站谷歌搜索引擎优化seo
  • 企业网站建设方案范本湖南网站制作哪家好
  • 苏宁易购如何进行网站的建设和维护收录网站排名
  • 网站策划案模板全球网站排名前100
  • 政府门户网站建设经验总结黄页网络的推广网站有哪些软件
  • 网站优化的主要目的是什么chatgpt 链接
  • 女生做a视频的网站是什多少百度商店
  • wordpress 网站打开速度慢百度seo优化排名客服电话
  • 北京做网站的公司商丘优化公司
  • 石家庄seo网站建设百度推广账户搭建
  • 织梦wordpress百度seo官方网站
  • 宜春建设局网站百度词条官网入口
  • 十天学会网站建设深圳网络营销推广方案
  • 做厂家批发的网站搜索引擎优化的方式
  • 网页设计 站点爱站关键词挖掘工具
  • 绍兴免费网站建站模板今天国内新闻10条
  • 界面设计排版seo排名工具给您好的建议下载官网
  • vs2017做的网站如何发布百度seo推广计划类型包含
  • 房产网站制作找哪家360社区app
  • 搭建网站需要什么软件云搜索下载
  • 网站怎么销售盐酸达泊西汀片是治疗什么的药物
  • 闸北做网站seo是什么意思 seo是什么职位
  • 开发公司春联seo排名怎么样
  • 做平面设计的网站有哪些网站怎么被百度收录
  • 哪个网站可以做记录视频百度网站分析
  • 怎么做招聘网站链接ttkefu在线客服系统官网
  • 刷关键词优化排名北京seo优化推广
  • 展示型网页开发公司福州seo管理