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

关于戒烟网站怎么做wordpress 平铺水印

关于戒烟网站怎么做,wordpress 平铺水印,2022年近期重大新闻事件,在国外做电商网站看如下代码#xff0c;这是一个完整的可运行的c源文件#xff0c;要注意的点#xff1a; c语言程序运行不一定需要头文件NULL其实是 (void*)0#xff0c;把指针赋值成(void*)0,就是防止程序员不想该指针被引用的时候被引用#xff0c;引用地址为0的值程序会引起系统中断这是一个完整的可运行的c源文件要注意的点 c语言程序运行不一定需要头文件NULL其实是 (void*)0把指针赋值成(void*)0,就是防止程序员不想该指针被引用的时候被引用引用地址为0的值程序会引起系统中断程序会异常终止可能会有人觉得别人讲链表都是malloc怎么这里没有mallocmalloc是用来申请内存的比较灵活可以自由改变链表长度这里用赋值的方法是因为从最简单的开始讲更能讲清楚原理 #define NULL (void*)0 struct list{int num;/*单向链表需要一个结构体指针指向下一个节点的地址如果是尾巴节点则是NULL*/struct list *next; }; int main() {struct list n0 {100, NULL};struct list n1 {29, NULL};struct list n2 {78, NULL};struct list n3 {24, NULL};n0.next n1;n1.next n2; // 等价 n0.next-next n2n2.next n3; // 等价 n0.next-next-next n3return 0; }我们先执行完main函数里面前四句赋值语句 用gdb查看n0, n1, n2, n3的地址如下他们的地址都是不一样的因为他们在内存的不同的地方他们也没有什么关系你们运行出来的内存地址应该和我的不一样无需产生疑惑 他们在你的内存条里像这样分布没什么特点就是四个结构体他们占用的大小一样都是sizeof(struct list) 我们再查看他们的值都是初始化的值没错 执行 n0.next n1; 就是把n1的地址挂在n0的尾巴上next指针这样就可以通过n0.next来表示n1查看n0.next发现变成了n1的地址 执行 n1.next n2;和 n2.next n3 经过上面的解释这两句应该很好理解就是把n2的地址挂在n1的next上n3的地址挂在n2的next上现在就组成了一个简单的链表就可以通过结构体n0通常称之为头节点访问这个链表上的任何数据 使用malloc申请内存的方式创建链表 #include stdlib.h struct list{int num;struct list *next; }; int main() {struct list *tmp_node;struct list *head (struct list*)malloc(sizeof(struct list));head-num 10;head-next NULL;/*添加节点*/tmp_node (struct list*)malloc(sizeof(struct list));tmp_node-num 3;tmp_node-next NULL;head-next tmp_node;/*添加节点*/tmp_node (struct list*)malloc(sizeof(struct list));tmp_node-num 5;tmp_node-next NULL;head-next-next tmp_node;/*添加节点*/tmp_node (struct list*)malloc(sizeof(struct list));tmp_node-num 80;tmp_node-next NULL;head-next-next-next tmp_node;return 0; }这段代码并不难看懂就是创建一个节点然后挂在head的尾巴上可是这里有缺陷就是每次都要自己记住有几个节点然后用 head-next-next-next tmp_node;的语句去接上节点这样太麻烦了我们可以再创建一个尾节点来表示这个链表的尾巴节点。 #include stdlib.h struct list{int num;struct list *next; }; int main() {struct list *tmp_node;struct list *head (struct list*)malloc(sizeof(struct list));head-num 10;head-next NULL;/*刚开始头就是尾这个能理解吧*/struct list *tail head;/*添加节点*/tmp_node (struct list*)malloc(sizeof(struct list));tmp_node-num 3;tmp_node-next NULL;tail-next tmp_node; //接到尾巴上tail tail-next; //因为后面有新的节点尾巴要更新位置了移到新节点了/*添加节点*/tmp_node (struct list*)malloc(sizeof(struct list));tmp_node-num 5;tmp_node-next NULL;tail-next tmp_node;tail tail-next;/*添加节点*/tmp_node (struct list*)malloc(sizeof(struct list));tmp_node-num 80;tmp_node-next NULL;tail-next tmp_node;tail tail-next;return 0; }记住两点 头节点一般不移动每一次操作完毕后尾节点都是指向最后一个节点的地址 取下/删除链表节点 增加链表节点 插入链表节点 待更新
http://www.huolong8.cn/news/397614/

相关文章:

  • 中国特种做业人员备案考核是什么网站用php做网站流程
  • 电子商务网站设计的原则和内容静态购物网站模板
  • 国外网站翻墙怎么做工业设计创意网站
  • 深圳网站建设ucreator建盏世家直播
  • 苏州找工作网站有哪些seo的搜索排名影响因素有哪些
  • 怎么制作网站弹出广告广告网站建设
  • 网站编辑招聘门户网站的建设费用
  • 网站改版设计费进什么科目好的免费移动网站建设平台有哪些
  • 怎样实现wordpress订单提醒功能网站竞价难做优化
  • 石嘴山市建设局网站如何查看网站域名信息
  • 中企动力建设网站苏州注册公司好快记财务
  • 怎么做蛋糕店的网站免费下载一个app
  • 建个人免费网站用哪个哪里有服务好的网站建设
  • 如果自己弄网站个人简历ppt
  • 公家网站模板宁波网站建设建站厂家
  • 专门做进口产品的网站6河北做网站公司那家好
  • 不会编程怎样建设网站阿里云网站建设初衷
  • 才艺多网站建设中国网页设计师
  • 公司网站建设外包wap 网站 开发
  • 网站开发客户来源广东省建设厅网站可以查
  • 医保局网站建设中标公告server2008部署网站
  • wordpress企业网站模板破解昆明关键词优化
  • 零售网站模板制作微信的网站
  • 做网站公司599湘潭做网站广告的公司
  • 安福县住房和城乡建设局网站青岛网站建设新元创想
  • 专业的个人网站建设哪家南充建网站的资料
  • 石家庄做网站的公司有哪些网站如何做谷歌推广
  • 网站建站分为两种PS做任务的网站
  • jsp网站 iis做不锈钢管网站
  • 茂名seo网站建设青岛注册公司网站