I'm going crazy trying to figure out this error message that has no obvious connection to reality/my code. I've been searching on here and come to one conclusion: you're going to hate the pointer hidden by typedef. Sorry, it's out of my control--prof provided the code that way. I'm editing the code as specified in the problem. I'm popping full nodes to avoid malloc calls on each push function and storing them in a secondary stack. The MakeEmptyS function initializes a Stack with INITIAL_SIZE nodes. GrowEmptyS adds more nodes to the Stack of empty nodes
stack.c has the following function:
void
MakeEmptyS( Stack S )
{
PtrToNode tmp;
if ( S == NULL )
Error( "Must use CreateStack first" );
else
{
GrowEmptyS( S, INITIAL_SIZE);
while (!IsEmptyS( S) )
{
tmp = TopopNode( S );
PushEmpty( S, tmp);
}
}
}
I get this error: "Stack.c:53:22: error: expected expression before '=' token", where line 53 is GrowEmptyS( S, INITIAL_SIZE );
For reference, here is the Grow function:
void
GrowEmptyS( Stack S, int NumToAdd )
{
int i;
PtrToNode TmpCell;
for( i = 0; i < NumToAdd; i++ )
{
TmpCell = malloc( sizeof(struct Node));
if ( TmpCell == NULL )
FatalError( "Out of Space!!!");
else
PushEmpty(S,TmpCell);
}
}