warning: ISO C++ forbids variable length array

Array in C++ must have a size defined at compile-time. If you want variable length array, use std::vector instead. In your case, I would use template for Matrix Size and have different implementation for different matrix size (unless I misunderstood your intentions). Since I did not defined the generic template, using any other value than 2 or … Read more

How do I declare a 2d array in C++ using new?

If your row length is a compile time constant, C++11 allows See this answer. Compilers like gcc that allow variable-length arrays as an extension to C++ can use new as shown here to get fully runtime-variable array dimension functionality like C99 allows, but portable ISO C++ is limited to only the first dimension being variable. Another efficient option is … Read more

How to print the array?

What you are doing is printing the value in the array at spot [3][3], which is invalid for a 3by3 array, you need to loop over all the spots and print them. This will print it in the following format if you want more exact formatting you’ll have to change how the printf is formatted.

How to create multidimensional array

http://jsfiddle.net/z4Un3/ And if you’re wanting to store DOM elements: Not real sure how useful the above is until you attach the elements. The below may be more what you’re looking for: http://jsfiddle.net/z4Un3/3/ Or, maybe this: Which gives: In the console. If you want to output that to text, you can result.join(‘ ‘);, which would give you 2 … Read more