j********g 发帖数: 44 | 1 It is said that statically allocated array must have length which should
be const or const expression.
I could not understand why the following works just fine:
#include
using namespace std;
int main()
{
int m,n;
cin>>m>>n;
double a[m][n], x[n], b[m];
for(int i=0;i
b[i]=i*i;
for(int i=0;i
cout<
int staff_size=27;
double salary[staff_size];
return 0;
} |
p***o 发帖数: 1252 | 2 That's an extension of your compiler (most likely g++).
The current C++ standard doesn't allow you to do so
(update me if it is allowed in C++0x).
【在 j********g 的大作中提到】![](/moin_static193/solenoid/img/up.png) : It is said that statically allocated array must have length which should : be const or const expression. : I could not understand why the following works just fine: : #include : using namespace std; : int main() : { : int m,n; : cin>>m>>n; : double a[m][n], x[n], b[m];
|
P*******b 发帖数: 1001 | 3 C99可以
【在 p***o 的大作中提到】![](/moin_static193/solenoid/img/up.png) : That's an extension of your compiler (most likely g++). : The current C++ standard doesn't allow you to do so : (update me if it is allowed in C++0x).
|
p***o 发帖数: 1252 | 4 LZ's code is in C++ but not C.
【在 P*******b 的大作中提到】![](/moin_static193/solenoid/img/up.png) : C99可以
|