在C+書籍中,數組綁定必須是常量表達式,但是為什么下面的代碼工作呢?#include <iostream>using namespace std;int main(){
int n=10;
int a[n];
for (int i=0; i<n; i++) {
a[i]=i+1;
cout<<a[i]<<endl;}
return 0;}在mac下的Xcode 4中工作得很好正如書中所說,它應該是錯誤的,為什么?如此迷茫~
- 3 回答
- 0 關注
- 723 瀏覽
添加回答
舉報
0/150
提交
取消