Home > Back-end >  Can help to have a look at why the output is always more than a string of 1769096293
Can help to have a look at why the output is always more than a string of 1769096293

Time:11-02

#include
#include
# define MaxSize 50

typedef int ElemType;
Typedef struct
{ElemType data [MaxSize];
int length;
} SqList;

Void CreateList (SqList * & amp; P, ElemType a [], int n)//build order table
{
int i;
P=(SqList *) malloc (sizeof (SqList));
for (i=0; iP - & gt; Data=[I] a [I];
P - & gt; Length=n;
}

Bool ListEmpty (SqList * p)//to empty
{
Return (p - & gt; Length==0);
}

Void InitList (SqList * & amp; P) {//initializes the
P=(SqList *) malloc (sizeof (SqList));
If (p==NULL)
{
exit(0);
}
P - & gt; Length=0;
}

Void DispList (SqList * p)//output
{
int i;
If (ListEmpty (p)) return;
for (i=0; i

Printf (" % d ", p - & gt; Data [I]);
printf("\n");
}

Void Inverse (SqList * p) {//reverse placed
int j;
If (ListEmpty (p)) return;
For (j> (p - & gt; Length) - 1; j>=0; J -)
Printf (" % d ", p - & gt; Data [j]);
printf("\n");
}

Void DestroyList (SqList * & amp; P)//destruction of linear table
{
Free (p);
P=NULL;
}

Int main () {
SqList * p=NULL;
InitList (p);

ElemType e;
,2,3,4,5,6,7,8 ElemType a []={1};
CreateList (p, a, 8).
DispList (p);
The Inverse (p);
DestroyList (p);

return 0;
}

CodePudding user response:

 
Void Inverse (SqList * p) {//reverse placed
int j;
If (ListEmpty (p)) return;
For (j=(p - & gt; Length) - 1; j>=0; J -)
Printf (" % d ", p - & gt; Data [j]);
printf("\n");
}


This function you beat=up & gt;
  • Related