1. 程式人生 > 其它 >error: expected declaration specifiers or ‘...’ before numeric constant

error: expected declaration specifiers or ‘...’ before numeric constant

技術標籤:C語言

今天遇到了這個錯誤,很奇怪,最終解決了。

可以產生這個錯誤的示例程式碼如下:

#include <stdio.h>

#define VALUE 1

int func(int a)
{
    printf("%d\n",a);
    return 0;
}

int main()
{
    int func(VALUE);
    return 0;
}

編譯:

函式func呼叫的時候,多加了返回值型別,所以報了這個錯誤。