数组a[N],N需为常量

  昏了头,这竟然忘了,纠错搞了半天。

const int N = 10;
int a [N];
//这是对的,因为const指定为常量

const int N = 10;
int M = 2 * N;
int a[M];
//这是错的,因为M为变量。

 

posted @ 2023-10-21 21:44  Geni_w  阅读(45)  评论(0)    收藏  举报