要做C++我使用的是dev C++。現在我需要與Visual Studio工作C++數組Visual Studio
我做同樣的程序,但在Visual Studio中我有我以前沒有在C++中
與此
int project = (rand() % 5) + 1 ;
int P[project][3];
我有一個錯誤以下錯誤:
error C2057: expected constant expression
error C2466: cannot allocate an array of constant size 0
error C2133: 'P' : unknown size
你能幫助理解這個錯誤嗎?
謝謝
好吧,一些編譯器支持這個,但它肯定是一個擴展(請參閱http://stackoverflow.com/questions/1204521/dynamic-array-in-stack) – 2013-03-18 07:17:10