VC 警告信息的解释chuzhan not all control paths return a value*/
jasper 发表于2010年05月10日 22:39
阅读(0) 评论(
0)
分类: VC警告 权限: 公开
/*建立链栈*/ #include "stdio.h" #include "stdlib.h" #include "conio.h" #define E sizeof(struct stud) typedef struct stud { int data; struct stud *next; }st; void ruzhan(st **t,int x) { st *q; if((q=(st*)malloc(E))==NULL) { printf("/n分配失败了:/n"); getch(); exit(0); } q->data=x; q->next=*t; *t=q;/* 重新指向*/ } panduan(st *t) {if(t==NULL) return 0; else return 1; } int chuzhan(st **t,int *x) { st *q=NULL; if(*t!=NULL) { q=(*t); *x=(*t)->data; (*t)=(*t)->next; free(q); return *x; } else return 0;/* 如果要是为printf("jdk")会提示 chuzhan not all control paths return a value*/ } main() { st *r=NULL;/* 开始用**r=NULL*/ int x,q; printf("/n 开始输入值:/n"); scanf("%d",&x); while(x!=0) { ruzhan(&r,x); scanf("%d",&x); } while(panduan( &*r)) { q=chuzhan(&r,&x); printf("%2d",q); } getch(); } chuzhan not all control paths return a value*/
看来这个VC注重强
但是,开始我没有发现,虽然是警告但是,却不能是程序终止,说明是纯粹 的语法警告,
恩,这是我突然发现的 ,恩,看来就我错了
牢记啊,
|