Home > Software engineering >  Help... Why the initialization sequence table where will the next line error ah..
Help... Why the initialization sequence table where will the next line error ah..

Time:11-18

Typedef struct
{
DataType data [ListSize];
DataType length;
} SeqList above change will be the next line elsewhere at this mistake;
Void main () {



The error C2144: syntax error: missing '; 'before the type' void '
Fatal error C1004: unexpected end of file found

Behind the SeqList plus a semicolon error is more behind the SWITCH calls the function also has a problem,,, just learn good south, data structure,

The following is the complete code
# define ListSize 20
# include
# include
Typedef int DataType.
Void InitList ();
Void lastinto ();
Void findone ();
Int sureinto ();
Void watchall ();
Void ClearList ();
Void the alter ();

Int delsure ();//10

Typedef struct
{
DataType data [ListSize];
DataType length;
} SeqList
Void main () {
Int I, s=1, e, z;
While (s) {
Printf (" please enter to operate: \ n ");
Printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \ n ");
Printf (" | | 1: create a new table \ n ");
Printf (" | 2: tail interpolation insert data \ n | ");
Printf (" \ n | | 3: place named insert data ");
Printf (" | | 4: delete specified locations \ n ");//20
Printf (" \ | 5: modify the designated place position n | ");
Printf (" \ n | | 6: search data ");
Printf (" | | 7: check the order table \ n ");
Printf (" | 8: empty sequence table \ n | ");
Printf (" | | 9: exit \ n ");
Printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \ n ");
The scanf (" % d ", & amp; I);
If (i<0 | | i> 8) {
Printf (" error ");
}//30
The switch (I) {
Case 1: InitList (L); break;
Case 2: the scanf (" % d ", & amp; E); Lastinto (L, e); break;
Case 3: the scanf (" % d ", & amp; E); The scanf (" % d ", & amp; Z); Sureinto (L, e, z); break;
Case 4: the scanf (" % d ", & amp; E); The scanf (" % d ", & amp; Z); Delsure (L, e, z); break;
Case 5: the scanf (" % d ", & amp; E); The scanf (" % d ", & amp; Z); The alter (L, e, z); break;
Case 6: the scanf (" % d ", & amp; E); Findone (L, e); break;
Case 7: watchall (L); break;
Case 8: ClearList (L); break;
Case 9: s=0; break;//40
}
}
}


Void InitList (SeqList L) {

If (L - & gt; Length==0) {
return;
}
L - & gt; Length=0;
}

Void lastinto (SeqList L, DataType e) {
If (L - & gt; Length==ListSize)//60
{
Printf (" order form is full, can't insert! \n");
}
L - & gt; Data [L - & gt; length]=e;
L - & gt; length++;
}
Int sureinto (SeqList L, DataType e, int z) {

If (z<1 | | z> L - & gt; Length)
{//70
Printf (" insert position illegal! \n");
return 0;
}
If (L - & gt; Length==ListSize)
{
Printf (" order form is full, can't insert! \n");
}
Int x=L - & gt; Length, k;
For (k=z; k<=L - & gt; Length; K++)
{//80
L - & gt; Data [x]=L - & gt; Data [x - 1);
X -;
}
L - & gt; Data [z - 1]=e;
L - & gt; length++;
return 1;
}
Int delsure (SeqList L, DataType * e, int z) {
Int k, x;
If (z> L - & gt; Length | | L - & gt; Length<1) {//90
Printf (" error ");
return 0;
}
* e=L - & gt; Data [z - 1);
For (k=z; k<=L - & gt; Length; K++)
{
L - & gt; Data [1] x=L - & gt; Data [x];
X++;
}
L - & gt; Length -;//100
Return * e;
}
Void the alter (SeqList L, DataType e, int z) {
If (z<1 | | z> L - & gt; Length + 1) {
Printf (" error ");
}
The else {
L - & gt; Data [z - 1]=e;
}
}//110
Void ClearList (SeqList L)
{
L - & gt; length=0;
}
Void watchall SeqList (L) {int k;
For (k=0; K & lt; L - & gt; Length; K++)
{
Printf (" % d, L - & gt; Data [k]);
}
printf("\n");//120
}
Void findone (SeqList L, DataType e) {
Int k; Int l=0;
for(k=0; kL++;
If (L - & gt; Data [k]==e) {
Printf (" the subscript for % d ", l);
}
}
}

CodePudding user response:

} SeqList;

CodePudding user response:

reference 1st floor schlafenhamster response:
} SeqList;

Add a semicolon will offer a lot of trouble, by the way ask next my wrong main function has not been initialized sequence table L call a function initializes the order form parameter L can it

CodePudding user response:

Void InitList (SeqList * L) {

CodePudding user response:

Typedef struct
{
DataType data [ListSize];
DataType length;
} SeqList
Change
Struct SeqList
{
DataType data [ListSize];
DataType length;
};
At the same time move it to the typedef int DataType. Back and modify the function declaration:
Typedef int DataType.
Struct SeqList
{
DataType data [ListSize];
DataType length;
};
Void InitList (SeqList L);
Void lastinto (SeqList L, DataType e);
Int sureinto (SeqList L, DataType e, int z);
Int delsure (SeqList L, DataType * e, int z);
Void the alter (SeqList L, DataType e, int z);
Void ClearList (SeqList L);
Void watchall SeqList (L);
Void findone (SeqList L, DataType e);

CodePudding user response:

With the moderator, cause of the error in the impression should be in when to use typedef struct, struct should use famous structure, and construction of the building use is unknown,

red reference 4 floor - fly reply:
typedef struct
{
DataType data [ListSize];
DataType length;
} SeqList
Change
Struct SeqList
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related