以下是引用孤独败天在2007-9-26 18:26:23的发言:
#include <stdio.h>
struct student
{
char name[20];
int score;
struct student *next;
};
typedef struct student mys;
void main()
{
mys *head, *p, *q;
head=(mys *)malloc(sizeof(mys));
head->next=NULL;
p=head;
q=(mys *)malloc(sizeof(mys));
strcpy(q->name,"110");
q->score=001;
q->next=NULL;
` head->next=q;
q=(mys *)malloc(sizeof(mys));
strcpy(q->name,"500");
q->score=002;
q->=NULL;
p->next=q;
q->next=q;
p=head->next;
while(q!=NULL)
{printf("%s\t%d",q->name,q->score)
p=p->next;}
}前辈们 谁能告诉我用for循环做链表啊?如果你还能再来看到,你要回答的是要一个具体的目的,用for设计一个具体的链表?