node * 和 node **的使用
来源:互联网 发布:中国名校网络教育联盟 编辑:程序博客网 时间:2024/05/21 07:12
#include<iostream>using namespace std;struct node{node* prev;int value;node* next;};void reverse2(struct node **head){struct node *temp = NULL;struct node *current = *head;cout << "this is the address of my point thinkEEEE " << &(*head) << endl;while (current != NULL){temp = current->prev;current->prev = current->next;current->next = temp;current = current->prev;}if (temp != NULL)*head = temp->prev;cout << "this is the address of my point think@@@@ " << &(*head) << endl;}node * reverse1(struct node *head){struct node *temp = NULL;struct node *current = head;cout << "this is the address of point my thinkQQQQ " << &head << endl;while (current != NULL){temp = current->prev;current->prev = current->next;current->next = temp;current = current->prev;}if (temp != NULL)head = temp->prev;return head;}int main(){/*双向链表1<-->2<-->3*/node node1, node2, node3;node1.prev = NULL;node1.value = 1;node2.prev = &node1;node2.value = 2;node3.prev = &node2;node3.value = 3;node1.next = &node2;node2.next = &node3;node3.next = NULL;node *head = &node1;//head = reverse1(head);reverse2(&head);cout << "this is the address of my point think##### " << &head << endl; cout << "after the reverse ";while (head != NULL){cout << head->value << " ";head = head->next;}system("pause");}/* 调用reverse1函数后的结果,可以发现输出的地址是不一样的 this is the address of point my thinkQQQQ 008FF7CC this is the address of my point think##### 008FF8A0 after the reverse 3 2 1 请按任意键继续. . .*//* 调用reverse2函数后的结果,可以发现输出的地址是一样的 this is the address of my point thinkEEEE 0113FC14 this is the address of my point think@@@@ 0113FC14 this is the address of my point think##### 0113FC14 after the reverse 3 2 1 请按任意键继续. . .*/
阅读全文
0 0
- node * 和 node **的使用
- Node安装和使用
- node-sass 的安装和使用
- node调式工具node-inspector的使用
- global $node 和$node的区别
- node-schedule的使用
- node的使用
- node.js的使用
- node Express安装和使用
- node Express安装和使用
- 【Node】node的模块
- c#和node.js交互,edge库的使用,node.js执行c#代码
- Node.js学习(一)——Node.js的安装和express初步使用
- 关于在Drupal中使用REST Server 增加node时有taxonomy_term 和 node reference的解决方法
- node使用
- node中url的使用
- node和npm的安装
- Node和Element的区别
- 吴恩达《深度学习》课程
- getParameter()&getAttribute()的区别
- RedHat虚拟机配置ssh免密登录无效的问题解决
- Hibernate 多对一小案例
- 使用内部的MSI振荡器给STM32L476RG单片机提供80MHz的时钟
- node * 和 node **的使用
- Java-排序算法之插入排序算法
- 流程控制
- 快速幂 取模
- poj 2429 GCD & LCM Inverse
- Hibernate (分页,一对多,多对多,多对一)案例
- BZOJ1218: [HNOI2003]激光炸弹
- 栈和队列的应用:迷宫问题
- AndroidStudio导入项目在 Building gradle project info 一直卡住