# include
# define MAX 20
Typedef struct {
int n;
The int data [MAX + 1];
} SEQTABLE;
Void delitem (SEQTABLE * st, int e)
{
int i;
for(i=1; i<=st - & gt; n; I++)
{
If (st - & gt; Data [I]==e)
{
For (I; i
- st - & gt; n;
- I;
}
}
}
Int main ()
{
int i;
SEQTABLE st={9,,5,7,9,8,7,2,6,7,9 {0}};
Delitem (& amp; St, 7);
For (I=1; I & lt;=st. n; I++)
{
Printf (" % 4 d, "st. data [I]);
}
printf("\n");
return 0;
}
CodePudding user response:
To write, you inside a for loop to I go to the st - & gt; N, peripheral circulation will only go to the first 7 stopped there# include
# include
# define MAX 20
Typedef struct {
int n;
The int data [MAX + 1];
} SEQTABLE;
Void delitem (SEQTABLE * st, int e)
{
int i, j;
for(i=0; i<=st - & gt; n; I++)
{
J=I;
If (st - & gt; Data [I]==e)
{
For (j; jSt - & gt; Data [j]=st - & gt; Data [j + 1);
- st - & gt; n;
- I;
}
}
}
Int main ()
{
int i;
SEQTABLE st={9,,5,7,9,8,7,2,6,7,9 {0}};
Delitem (& amp; St, 7);
for(i=0; I & lt;=st. n; I++)
{
Printf (" % 4 d, "st. data [I]);
}
printf("\n");
return 0;
}