C编译错误:Main.c:4:5: error: variably modified ‘f’ at file scope int f[maxn];

错误范例:

  

#include<stdio.h>

const int maxn=10000+10;
int f[maxn];
int cnt;

 

错误原因:

C中const不是指常量,而是表示只读;const声明常量是在C++中的用法

C中声明一个固定长度数组,可用:

  

#define MAXN 256
int f[MAXN];

 

posted @ 2020-04-04 12:03  JC97  阅读(635)  评论(0编辑  收藏  举报