创建链表后将链表输出的问题
struct student{ int nNumber; int nSorce; char sName[20]; struct student * spNext;};#define LEN sizeof(struct student)struct student * STD_creatLinkList(){ struct student * spHead; struct student * sp1; struct student * sp2; int nIndex = 0; int nFlag = 0; sp1 = (struct student *) malloc(LEN); sp2 = (struct student *) malloc(LEN); spHead = sp1; for (nIndex = 0; nIndex < 5; nIndex++) { sp1->nNumber = 1201 + nIndex; sp1->nSorce = 0; strcpy(sp1->sName, "student"); sp1->spNext = sp2; sp1 = sp2; sp2 = (struct student *) malloc(LEN); } sp1->spNext = NULL; return spHead;}void main(){ struct student * spHead; spHead = STD_creatLinkList(); while(spHead != NULL) { printf("%d,%d,%s\n",spHead -> nNumber,spHead -> nSorce,spHead -> sName); spHead = spHead -> spNext; } while(1) { }}