Multidimensional-arrays can be described as "arrays of arrays". Multidimensional-arrays are often used to put values in a table format (e.g. rows and columns).

learn more… | top users | synonyms

167
votes
5answers
27k views

How do I use arrays in C++?

C++ inherited arrays from C where they are used virtually everywhere. C++ provides abstractions that are easier to use and less error-prone (std::vector<T> since C++98 and std::array<T, n> ...
158
votes
5answers
94k views

Sort multidimensional Array by Value (2) [duplicate]

Possible Duplicate: How do I sort a multidimensional array in php How can I sort this array by the value of the "order" key? Even though the values are currently sequential, they will not ...
81
votes
4answers
22k views

What is differences between Multidimensional array and Array of Arrays in C#?

What are the differences between multidimensional arrays and array-of-arrays in C#? If there is a difference, what is the best use for each one?
30
votes
11answers
18k views

How to Flatten a Multidimensional Array?

Is it possible, in PHP, to flatten a (bi/multi)dimensional array without using recursion or references? I'm only interested in the values so the keys can be ignored, I'm thinking in the lines of ...
61
votes
25answers
46k views

How do you rotate a two dimensional array?

Inspired by Raymond Chen's post, say you have a 4x4 two dimensional array, write a function that rotates it 90 degrees. Raymond links to a solution in pseudo code, but I'd like to see some real world ...
157
votes
13answers
221k views

How can I create a two dimensional array in JavaScript?

I have been reading online and some places say it isn't possible, some say it is and then give an example and others refute the example, etc. How do I declare a 2 dimensional array in JavaScript? ...
40
votes
7answers
36k views

in_array() and multidimensional array

I use in_array() to check whether a value exists in an array like below, $a = array("Mac", "NT", "Irix", "Linux"); if (in_array("Irix", $a)) { echo "Got Irix"; } //print_r($a); but what about ...
1
vote
2answers
828 views

dynamical two dimension array according to input

I need to get an input N from the user and generate a N*N matrix. How can I declare the matrix? Generally, the size of the array and matrix should be fixed at the declaration, right? What about ...
3
votes
3answers
375 views

How do I correctly set up, access, and free a multidimensional array in C?

I have seen dozens of questions about “what’s wrong with my code” regarding multidimensional arrays in C. For some reason people can’t seem to wrap their head around what is happening here, so I ...
33
votes
2answers
34k views

Submitting a multidimensional array via POST with php

I have a php form that has a known number of columns (ex. top diameter, bottom diameter, fabric, colour, quantity), but has an unknown number of rows, as users can add rows as they need. I've ...
2
votes
2answers
566 views

String with array structure to Array

I have string: Main.Sub.SubOfSub And some kind of data, may be a string: SuperData Also I have an empty array: $k = array(); How I can transform it all to this array above? Array ( [Main] ...
1
vote
3answers
2k views

Multidimensional array iteration

Say you have the following array: $nodes = array( "parent node", "parent node", array( "child node", "child node", array( "grand child node", ...
7
votes
3answers
2k views

PHP Create a Multidimensional Array from an array with relational data [duplicate]

Possible Duplicate: Converting an array from one to multi-dimensional based on parent ID values I am working in PHP. I have the following array that has relational data (parent child ...
36
votes
7answers
16k views

Matrix Transpose in Python

I am trying to create a matrix transpose function for python but I can't seem to make it work. Say I have theArray = [['a','b','c'],['d','e','f'],['g','h','i']] and I want my function to come up ...
8
votes
5answers
8k views

php multi-dimensional array remove duplicate

Not sure if this question is a duplicate in need of removal, but I couldn't find the answer elsewhere so I'll have a go at asking. I've got a 2d array that looks as follows: Array ( [0] => Array ...

1 2 3 4 5 42
15 30 50 per page