⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lianbiao2.c

📁 链表的测试 使用方式 添加,删除方法的实现
💻 C
字号:
#include "stdlib.h"
#include "stdio.h"
#include "conio.h"
struct list
{
  int data;
  struct list *next;
};
typedef struct list node;
typedef node *link;
void main()
{
  link ptr,head;
  int num,i;
  ptr=(link)malloc(sizeof(node));
  ptr=head;
  printf("please input 5 numbers==>\n");
  for(i=0;i<=4;i++)
  {
    scanf("%d",&num);
    ptr->data=num;
    ptr->next=(link)malloc(sizeof(node));
    if(i==4) ptr->next=NULL;
    else ptr=ptr->next;
  }
  ptr=head;
  while(ptr!=NULL)
  {
    printf("The value is ==>%d\n",ptr->data);
    ptr=ptr->next;
  }
  getch();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -