Create and output a simple linked list

Source: Internet
Author: User
Tags define null

#include <stdio.h>
#define NULL 0
struct student
Long num;
Float score;
struct Student * Next

void Main ()
struct student a,b,c, *head, *p;
A.num = 1001;
A.score = 89.2;
B.num = 1002;
B.score = 90.1;
C.num = 1003;
C.score = 92.1;
Head = &a; = &b; = &c; = NULL;
p = head;

printf ("%ld%5.2f\n", P->num,p->score);
p = p->next;
}while (P! = NULL);


At the beginning, the head points to a node, points to the B nodes, and points to the C node. This is the key relationship. is to make not point to any storage unit. To output a linked list, p is used to point p to the a node and then output the data in the a node.

Create and output a simple linked list

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.