Talk:Create a two-dimensional array at runtime: Difference between revisions

From Rosetta Code
Content added Content deleted
(The run-time requirement is there for a reason)
m (fixed indentation)
Line 3: Line 3:
: The point of this task is not ''how'' exactly the numbers are obtained, but that they are ''not known'' at compile time. That is, you cannot use any features of the language which depend on compile-time knowledge of the array size. As a concrete example, in C++ you cannot simply write
: The point of this task is not ''how'' exactly the numbers are obtained, but that they are ''not known'' at compile time. That is, you cannot use any features of the language which depend on compile-time knowledge of the array size. As a concrete example, in C++ you cannot simply write
double** array = new double[dim1][dim2];
double** array = new double[dim1][dim2];
because for that dim2 would have to be a compile time constant. It ''would'' be a solution if you dropped the requirement that ''both'' dimensions are given at run time. --[[User:Ce|Ce]] 12:41, 11 January 2008 (MST)
: because for that dim2 would have to be a compile time constant. It ''would'' be a solution if you dropped the requirement that ''both'' dimensions are given at run time. --[[User:Ce|Ce]] 12:41, 11 January 2008 (MST)

Revision as of 19:42, 11 January 2008

The title of this page suggests it should really be two tasks: Create a multidimensional array and Read command-line arguments --Short Circuit 20:56, 12 November 2007 (MST)

Whether or not this is divided into multiple tasks, a more concise name must be possible, I'd think. --TBH 14:53, 10 January 2008 (MST)
The point of this task is not how exactly the numbers are obtained, but that they are not known at compile time. That is, you cannot use any features of the language which depend on compile-time knowledge of the array size. As a concrete example, in C++ you cannot simply write
double** array = new double[dim1][dim2];
because for that dim2 would have to be a compile time constant. It would be a solution if you dropped the requirement that both dimensions are given at run time. --Ce 12:41, 11 January 2008 (MST)