// 1233.cpp : Defines the entry point for the console application. //
#include “stdafx.h” #include <stdlib.h> #include <stdio.h> #include <string.h>
struct node {
int value;
node* next; };
//链表的逆序输出 递归算法 void out(node* head) {
if(head->next!=NULL)
{
out(head->next);
}
printf(“%d\n”,head->value); }
int main(int argc, char* argv[]) {
node* head=new node();
head->value=1;
node* p=new node();
p->value=2;
head->next=p;
node* q=new node();
q->value=3;
q->next=NULL;
p->next=q;
out(head);
return 0; }