请各位编程高手帮忙,小妹不胜感激

来源:百度知道 编辑:UC知道 时间:2024/05/08 06:42:36
这是我刚刚编的双向链标的建立程序,可是找不到出错的地方,请各位帮忙看一看。感激不尽!!

#include "stdafx.h"
#include "stdio.h"
#include "malloc.h"
#define I 4
struct JD
{
int num;
struct JD *prior,*next;
};

void main()
{
int a[I],i;
struct JD *s,*c;
struct JD *h,*l;
struct JD *pre;
struct JD *p;
printf("请从小到大输入四个数字:\n");
for(i=0;i<I;i++)
{
scanf("%d ",&a[i]);
}
{
h=(JD*)malloc(sizeof(JD));
l=(JD*)malloc(sizeof(JD));
h->num=0;
h->prior=NULL;
h->next=l;
l->num=0;
l->prior=h;
l->next=NULL;
for(i=I-1;i>0;i--)
{
if(i==I-1)
{
s=(JD*)malloc(sizeof(JD));
s->num=a[i];
s->next=h->next;
l->prior=s;
s->prior=l->prior;
h->next=s;
c=s;

}
els

请各位编程高手帮忙,小妹不胜感激
悬赏分:5 - 离问题结束还有 14 天 23 小时
这是我刚刚编的双向链标的建立程序,可是找不到出错的地方,请各位帮忙看一看。感激不尽!!

#include "stdafx.h"
#include "stdio.h"
#include "malloc.h"
#define I 4
struct JD
{
int num;
struct JD *prior,*next;
};

void main()
{
int a[I],i;
struct JD *s,*c;
struct JD *h,*l;
struct JD *pre;
struct JD *p;
printf("请从小到大输入四个数字:\n");
最后一行不对