I'm confused. Tutorial says the difference between 'normal' array and 'assigning dynamic memory to a pointer' is that normal array has to have declared size, whereas dynamic array can use a variable to declare an array (or assign memory to a pointer). i've checked this and the following code returns no errors while compiling and works:
I copied the code and tried to compile on MS VS 2005 and it threw and error. It will not allow an array to be declared with a variable. I think you will find that the reason it works for you is because your using a different compiler and that particular compiler allows you to declare an array with a variable.
I'm using linux's c++ compiler (gcc, however the command is 'c++')...
My O/S is fedora 8.
'c++ --version' = "c++ (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33)".
it throws 0 warnings or errors
so, is it correct or incorrect to use arrays this way?is it a standard?
i mean, maybe the reason are new headers/libraries and mainly 'updated' :P version of c++ (4.1.2)
-----------------------------------------------------
edit: ok there's an option '-pedantic' that solves the problem :P