Is this a correct ?
This is compiled with g++ (3.4) sucessfully.
Code:int main() { int x = 12; char pz[x]; }
This is a discussion on Dynamic array in Stack ? within the C++ Programming forums, part of the General Programming Boards category; Is this a correct ? This is compiled with g++ (3.4) sucessfully. Code: int main() { int x = 12; ...
Is this a correct ?
This is compiled with g++ (3.4) sucessfully.
Code:int main() { int x = 12; char pz[x]; }
If your aim is to write standard C++, then no, that is not correct. If your aim is to use g++'s variable length array compiler extension for g++, then yes, that is correct.Originally Posted by janaka
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
And if your intention was to write C99 code then it is valid. Otherwise use std::vector<char>.
I like squirrels