算法:剑指(3):从尾到头打印链表

链表学习:

#include<stdio.h>
#include<algorithm>
#include<vector>
#include <stack>

struct ListNode{
      int val;
       struct ListNode *next;
       ListNode(int x) :
             val(x), next(NULL) {
        }
 };
   
int main(){
    ListNode node1(1),node2(2);  
    node1.next= &node2;  
    printf("1=%d",(node1.next)->val);
    printf("2=%d",node2.val );

	return 0;

}

猜你喜欢

转载自blog.csdn.net/weixin_41108334/article/details/85600805