如何查找结点?
#include "stdafx.h"#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "malloc.h"
#define NULL 0
#define LEN sizeof(struct student)
struct student
{
long num;
float score;
struct student *next;
};
int main(int argc, char* argv[])
{
struct student a,b,c,*head,*p;//如何查找b的前一个结点a,b的后一个结点c;按照下标值查找
a.num=99101;a.score=89.5;
b.num=99103;b.score=90;
c.num=99105;c.score=91.5;
head=&a;
a.next=&b;
b.next=&c;
c.next=NULL;
p=head;
do
{
printf("%ld%5.1f\n",p->num,p->score);
p=p->next;
}while(p!=NULL);
return 0;
}