📄 diguilianbiao.cpp
字号:
// diguilianbiao.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
struct list_node
{
int data;
struct list_node *next;
};
typedef struct list_node node;
typedef node* link;
link creatlist(int *array,int len,int pos)
{
link newnode;
if(pos==len){
return NULL;
}
else
{
newnode=(link)malloc(sizeof(node));
if(!newnode)
return NULL;
newnode->data=array[pos];
newnode->next=creatlist(array,len,++pos);
return newnode;
}
}
void printlist(link head)
{
if (head!=NULL)
{
printf("%3d",head->data);
printf("\n");
printlist(head->next);
}
}
int main(int argc, char* argv[])
{
int array[6]={4,5,6,2,9,7};
link head;
head=creatlist(array,6,0);
printlist(head);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -