函数内int Sum[n][n]?
void fun( n ){
int Sum = [ n ][ n ];
……
}
void main( )
{
int n;
cin >> n;
fun( n );
}
D:\SeventySix\Six.cpp(44) : error C2057: expected constant expression
D:\SeventySix\Six.cpp(44) : error C2466: cannot allocate an array of constant size 0
D:\SeventySix\Six.cpp(44) : error C2057: expected constant expression
D:\SeventySix\Six.cpp(44) : error C2466: cannot allocate an array of constant size 0
D:\SeventySix\Six.cpp(44) : error C2087: '<Unknown>' : missing subscript
D:\SeventySix\Six.cpp(44) : error C2133: 'Sum' : unknown size
为什么函数中不能声明局部数组,如何解决,难道用动态分配?
望高人指点,谢谢!