如題,
`int n;
cin>>n;
int a[n];
c++可不可以這樣初始化數(shù)組啊,在VS2010中不可以,在devc++(編譯器gcc) 中可以。
歡迎選擇我的課程,讓我們一起見證您的進(jìn)步~~
This is the variable length array VLA in the C language C99 standard, which is not supported by the C++ standard. The gcc compiler supports variable-length arrays, but the vc compiler does not. Search for variable length arrays. There will be a lot of information on this (in Chinese and English). Stroustrup, the father of C++, talked about variable-length arrays on his website. There is a short paragraph. If you are interested, you can check it out http://www.stroustrup.com/bs_...