c错误:'int'之前的预期表达式

Cha*_*esX 1 c

这是我的演示.

#include <stdio.h>

int sqsum(int a, ...)
{
    va_list list;
    int b = 0,n = a;
    va_start(list,a);
    while(n > 0)
        {
            b = b+n*n;
            n = va_arg(list,int);
        }
    va_end(list);
    return b;
}

int main(int argc,char **argv)
{
    printf("%d\n",sqsum(1,2,3,-1));
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

然后我编译这个demo,它发生这个错误,我不知道这个错误意味着什么.

Sha*_*our 9

如果你没有包含#include <stdarg.h>并且它看起来不像你那样,那么这将解释你所看到的错误,否则程序看起来是正确的.如果我不包含该标题,则这些是我看到的错误gcc:

In function ‘sqsum’:
13:29: error: expected expression before ‘int’
Run Code Online (Sandbox Code Playgroud)