Variable Sized Arrays in C

前端 未结 5 1509
予麋鹿
予麋鹿 2020-12-17 02:17

I guess my question is whether the following is valid C

int main(void) {
  int r = 3;
  int k[r];
  return 0;
}

If so, would some one care

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-17 02:46

    The C99 standard added variable-length arrays, but other vendors such as GCC added them much earlier.

提交回复
热议问题