# include "stdlib. H"
//# include & lt; Stdbool. H>
100//# define Maxsize definition stack the maximum capacity of the
Typedef int Datatype.
Typedef struct
{Datatype data [Maxsize];//define the storage stack elements of the array, defining element in the stack, Datatype as elements of the data type
Int top;//define the stack pointer to the top of the stack
} Sqstack;
Void initstack (Sqstack * & amp; L)/* stack initialization order */
{L=(Sqstack *) malloc (sizeof (Sqstack));
L - & gt; Top=1;//initialize the stack pointer top to 1, the stack is empty
}
Int stackempty (Sqstack * L)/* whether order the stack is empty */
{
Return (L - & gt; Top=1);
}
Void main ()
{
Sqstack s;
Printf (" (1). Initialize the stack sequence; \n");
Initstack (s);
Printf (" (2). Whether order the stack is empty: ");
If (stackempty (s))
{
Printf (" this is an empty stack order. \n");
}
The else printf (" this is an empty stack order. \n");
}
K: \ data structure (C language) \ \ order stack \ new text documents. C (12) : error C2143: syntax error: missing ') 'before' & amp; '
K: \ data structure (C language) \ \ order stack \ new text documents. C (12) : error C2143: syntax error: missing '{' before' & amp; '
K: \ data structure (C language) \ \ order stack \ new text documents. C (12) : error C2059: syntax error: '& amp; '
K: \ data structure (C language) \ \ order stack \ new text documents. C (12) : error C2059: syntax error: ')
K: \ data structure (C language) \ \ order stack \ new text documents. C (43) : warning C4013: 'initstack undefined; Assuming extern returning int
K: \ data structure (C language) \ \ order stack \ new text documents. C (46) : error C2115: 'function: incompatible types
K: \ data structure (C language) \ \ order stack \ new text documents. C (46) : warning C4024: 'stackempty' : the company types for formal and actual parameter 1
An error occurred when executing cl. Exe.
CodePudding user response:
The parameters of the function prototype is a pointer type, the main function of s is not a pointerCodePudding user response:
# include "stdio.h"
# include "stdlib. H"
//# include & lt; Stdbool. H>
100//# define Maxsize definition stack the maximum capacity of the
Typedef int Datatype.
Typedef struct
{
Datatype data [Maxsize];//define the storage stack elements of the array, defining element in the stack, Datatype as elements of the data type
Int top;//define the stack pointer to the top of the stack
} Sqstack;
Void initstack (Sqstack * & amp; L)/* stack initialization order */
{
L=(Sqstack *) malloc (sizeof (Sqstack));
L - & gt; Top=1;//initialize the stack pointer top to 1, the stack is empty
}
Int stackempty (Sqstack * L)/* whether order the stack is empty */
{
//return (L - & gt; Top=1);
Return (L - & gt; Top==1);
}
//void main ()
Int main ()
{
//Sqstack s;
Sqstack * s;
Printf (" (1). Initialize the stack sequence; \n");
Initstack (s);
Printf (" (2). Whether order the stack is empty: ");
If (stackempty (s))
{
Printf (" this is an empty stack order. \n");
}
The else printf (" this is an empty stack order. \n");
}
For your reference ~
CodePudding user response:
Void initstack (Sqstack * & amp; L)The asterisk and & amp; Ed?
CodePudding user response: