| 发表于:2008-02-06 15:33:53 楼主 |
#include "stdlib.h" #include "stdio.h" struct slist { int data; struct slist *next; }; typedef struct slist slist; slist *creat_slist1() { int c; slist *h,*s,*r; h=(slist*)malloc(sizeof(slist)); r=h; scanf("%d",&c); while(c!=-1) { s=(slist*)malloc(sizeof(slist)); s-> data=c; r-> next=s; r=s; scanf("%d",&c); } r-> next='\0'; return h; } main() { slist *head; head=creat_slist1(); getch(); return 0; } 我在win-tc上运行这个单向链表程序,但会出现 警告 main.c : 'head' 被赋值但却没有使用在 main 函数中 请问为什么呢? |
|
|
|
|