由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - a novice c++ question: array with nonconstant length
相关主题
conversion between const to nonconst请教一个结构体占内存大小的问题
c vs c++(zz)C++11新特性
问个简单的C++问题指针的大小是 4 byte还是有赖于系统?
C/C++ __int64和long long, cross platform问题C puzzle 一日一题
ms cl.exe 的选项问一个defining array 的问题
C语言重复定义问题int F::*x = &F::x是什么意思?
C/C++里面求normal distribution的cdf有可直接调用的函数吗?求推荐:fortran好用的debug软件
请推荐一款windows xp 平台上优秀的C语言编译/编辑器c++ 语法
相关话题的讨论汇总
话题: int话题: c++话题: length话题: array
进入Programming版参与讨论
1 (共1页)
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 的大作中提到】
: 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 的大作中提到】
: 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 的大作中提到】
: C99可以
1 (共1页)
进入Programming版参与讨论
相关主题
c++ 语法ms cl.exe 的选项
JAVA的初衷本来就是C++太复杂了,productivity不行C语言重复定义问题
C和C++的复数C/C++里面求normal distribution的cdf有可直接调用的函数吗?
btw, MS C++ 是ECMA-372标准请推荐一款windows xp 平台上优秀的C语言编译/编辑器
conversion between const to nonconst请教一个结构体占内存大小的问题
c vs c++(zz)C++11新特性
问个简单的C++问题指针的大小是 4 byte还是有赖于系统?
C/C++ __int64和long long, cross platform问题C puzzle 一日一题
相关话题的讨论汇总
话题: int话题: c++话题: length话题: array