根据我的C ++教科书,以下表达式:
cout << "Enter number of students\n"; cin >> number; int score [number];
是ILLEGAL表达式。我不能使用变量作为数组大小。
我为什么不能这样做?(我不是在寻找替代方法,我还没有深入研究指针,向量等,但是我想了解这种行为。)
c++ arrays
arrays ×1
c++ ×1