Ç - 预计前pression之前'='令牌......在线没有'=' [英] C - expected expression before '=' token... on line without '='

查看:205
本文介绍了Ç - 预计前pression之前'='令牌......在线没有'='的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要疯了试图找出一个具有现实没有明显的联系/我的code此错误消息。我一直在这里寻找并得出一个结论:你要恨指针的typedef所隐藏。对不起,这是在我的掌握 - 教授提供的code的方式。我编辑code作为问题指定。我弹出全节点,以避免在每个推函数malloc调用和将它们存储在一个次级电池堆。该MakeEmptyS函数可INITIAL_SIZE节点的协议栈。 GrowEmptyS增加更多的节点空节点的堆栈

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具有以下功能:

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);
    }
  }
}

我得到这个错误:Stack.c:53:22:错误:之前的预期前pression'='令牌,其中第53行是GrowEmptyS(S,INITIAL_SIZE);

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);
       }
   }

推荐答案

我可能是错的,但可能是你定义

解决方案
I may be wrong but probably you defined

例如

您应该删除=。

正确的定义是

The correct definition would be

作为一个建议,函数的参数应该以较低的情况下,不上的情况下启动

As an advice, function parameters should start with lower case, not upper case :)

void GrowEmptyS(Stack stack, int numToAdd)

更容易阅读。

这篇关于Ç - 预计前pression之前'='令牌......在线没有'='的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆