###### Asked in Uncategorized

Uncategorized

# How can be represent two dimensional array in memory?

**We need you to answer this question!**

###### If you know the answer to this question, please register to join our limited beta program and start the conversation right now!

## Related Questions

###### Asked in Computer Programming

### What does a 2 dimensional array do?

A two dimensional array is a one-dimensional array of
one-dimensional arrays. That is, just as we can have an array of
integers, we can also have an array of integer arrays. This idea
can be extended such that we can have an array of two-dimensional
arrays (a three-dimensional array), and so on. We typically use a
two-dimensional array to represent a table of rows and columns,
where each row is a one-dimensional array.

###### Asked in Computer Programming

### What is a multi dimensional array?

A two-dimensional array is the simplest multi-dimensional array
and is implemented as a one-dimensional array where every element
is itself a one-dimensional array. We can imagine a two-dimensional
array as being a table of rows and columns where every row is an
array in its own right.
A three-dimensional array is simply a one-dimensional array of
two-dimensional arrays, which can be imagined as being an array of
tables. Extending the concept, a four-dimensional array is a table
of tables.
Multi-dimensional arrays may be jagged. That is, a
two-dimensional array may have rows of unequal length. Unlike
regular arrays, jagged arrays cannot be allocated in contiguous
memory. Instead, we use the outer array (the first dimension) to
store pointers to the inner arrays. An array of strings (character
arrays) is an example of a two-dimensional jagged array.

###### Asked in C Programming

### How 2 dimension array stored in memory?

A two-dimensional array simply an array of one-dimensional
arrays. That is, each element of the array is simply another array.
This notion can be extended to any number of dimensions.
Just as an array of int is stored as a contiguous sequence of
five integer elements, a two-dimensional array of int is stored as
a contiguous sequence of four intelements.

###### Asked in C++ Programming, Active Server Pages, ASP.NET

### How many types of arrays are in C?

An array is simply a contiguous block of memory containing two
or more elements. There are two types of array: a static array
which is allocated on the stack at compile time; and a dynamic
array which is allocated on the heap at runtime. Both can be
one-dimensional or multi-dimensional. A one-dimensional array can
be likened to a row (or column) of chessboard squares, with as many
squares as required to store all the elements. A multi-dimensional
array is any array with two or more dimensions. A two-dimensional
array can be likened to the whole chessboard, where any square can
be identified by its row and column index. However the dimensions
needn't be equal. A two-dimensional array can also be imagined as a
one-dimensional array where every element is simply another
one-dimensional array. Three-dimensional arrays can be likened to a
cube, or as a one-dimensional array of two-dimensional arrays. A
four-dimensional array can be linked to a one-dimensional array of
three-dimensional arrays, and so on. Although every one-dimensional
array must be allocated in contiguous memory, multi-dimensional
arrays can be dynamically allocated so that each dimension is
itself a separately allocated one-dimensional array of pointers to
the next dimension, making it possible to allocate extremely large
arrays over a series of smaller allocations rather than as a single
contiguous block.

###### Asked in C Programming

### How does two dimensional array differ from single dimensional array?

A one dimensional array is a scalar value repeated one or more
times.
A two dimensional array is an array of one dimensional
arrays.
A three dimensional array is an array of two dimensional
arrays, and so forth.
The one dimensional array is like a list of things, where the
two dimensional array is like an array of things. (Think one row
of a spreadsheet versus the whole spreadsheet.)
[addendum]
Every level of array depth is also a level of pointer depth. For
example: A 3 dimensional int array is an int***. So a one
dimensional int array is an int*, and a two dimensional int array
is an int**. This is only important if you are doing pointer work,
but it can become very important.

###### Asked in Computer Programming, C Programming

### What do you mean by one diamension array in C programming language?

An array is an aggregate of two or more un-named values of the
same type allocated within contiguous memory. All arrays can really
be considered one-dimensional because even a two-dimensional array
is really just an array of arrays. An array of strings is an
example of a two-dimensional array, but is usually easier to
imagine as being a one dimensional array of strings rather than as
being a one-dimensional array of character arrays. While its less
of a problem imagining a two dimensional array as being a table of
values arranged in rows and columns and a three dimensional array
as being an array of tables (or a "cuboid"), it's usually easier to
think of four or more dimensions in simple terms because it is hard
to imagine more than 3 dimensions within a 3 dimensional world. For
instance, a four-dimensional array might be easier to imagine as
being an array of cubes or as a table of tables. If you treat each
dimension as if it were one-dimensional, it becomes that much
easier to visualise.

###### Asked in C++ Programming

### What is single dimensional array in c plus plus?

A one dimensional array is an array of objects that goes in one
"direction". Any array with only one [] is a one dimensional array.
For example: int numbers[6]; is a one dimensional array.
int numbers[6][3]; is a two dimensional array.
Graphical terms:
One dimensional array[4]:
14 - 75 - 8164 - 234
Two dimensional array[2][3]:
47 - 178
108 - 85
17 - 128
It didn't come out quite how I wanted it...

###### Asked in Visual Basic Programming, C++ Programming

### Difference of single dimensional and multi dimensional array?

The short answer is that a single dimension array has just one
dimension while a multi-dimensional array has 2 or more
dimensions.
A single-dimension array can be thought of as being a row of
numbered pigeon holes, where the first pigeon hole is numbered 0.
This is what is meant by a zero-based index.
A multi-dimensional array can be thought of as being an array of
arrays. For example, a two-dimensional array is a one-dimensional
array of one-dimensional arrays. A chessboard is an example of a
two dimensional array, where each square is identified by an unique
row and column identifier. Two-dimensional arrays are often used to
represent tables and matrices.
A three-dimensional array can be thought of as being a 3D
cuboid, where each cell can be identified by three dimensions (such
as width, height and depth). However, it is more accurate to state
that a three dimensional array is a one-dimensional array of
two-dimensional arrays, because this then makes it easier to
comprehend four dimensional arrays (a one-dimensional array of
three dimensional arrays) and so on. Another way to think of four
dimensional arrays is as a row of cuboids. A five-dimensional array
is therefore a table of cuboids, while a six-dimensional array
becomes a cuboid of cuboids.
Regardless of the number of dimensions, each element in an array
is accessed through the array indices, such that there is one index
per dimension. However, since each element within a dimension has
the same number of elements, you can also use pointer arithmetic to
navigate the array. Indeed, that is exactly what happens behind the
scenes -- the index values are just sugar-coating to make arrays
easier to work with.

###### Asked in C Programming

### How do you initialise a two dimentional array?

C provides rectangular multidimensional arrays.
In C, a two-dimensional array is really a one-dimensional array,
each of whose elements is an array.
An array is initialized by a list of initializations in braces;
each row of a two-dimensional array is
initialized by a corresponding sub-list.
Example of two dimensional array initialization:
char array_example[2][4] = {
{11, 12, 13, 14},
{21, 22, 23, 24}
};

###### Asked in C Programming

### What are the different types of array explain with examples?

There are two main types of array:
1) Single dimensional array: These are arrays for which only one
index is required to access the element stored in an array. They
are stored in a contiguous memory location.
Eg:
int arr[10];//declaration
arr[7] = 7;//initialization
2) Multidimensional array: These are arrays for which more than
one index is required to access the element stored in a specific
location in the array. These are stored in a contiguous memory
location row-by-row.
Eg:
int arr[5][5];//two dimensional array
int arr[5][5][5];//three dimensional array

###### Asked in C Programming

### How do you declare 2 dimension arrays?

All arrays are one-dimensional. A two-dimensional array is
simply a one-dimensional array of one-dimensional arrays:
int a[2][3];
This is an array of 2 elements where each element is itself an
array of 3 integers. In other words it is an array of 6 integers.
The two dimensions simply allow us to split the array into two
sub-arrays of 3 elements each.

###### Asked in C Programming

### What is an array for 2 times 3?

An array of 2 times 3 is a one-dimensional array of 2 elements
each of which is a one-dimensional array of 3 elements. In other
words, it is an array of arrays, also known as a two-dimensional
array. We can imagine a two dimensional array as being a table with
rows and columns. A 2 times 3 array has 2 rows and 3 columns. Each
row is itself an array of 3 elements. However, we can also say that
each column is an array of 2 elements.

###### Asked in C Programming, C++ Programming

### Can an array of pointers represent multidimensional array?

Yes. More specifically, they can be used to represent a dynamic
multi-dimensional array.
As most people know, for a one-dimensional dynamic array, you
simply need a pointer to the first element in the array, where each
element contains an object of the same type as the pointer. The
pointer can be passed around functions just as if it were a static
array, the only difference being the requirement to pass the upper
bound of the array as well as the array itself.
For a two-dimensional array, you need a pointer-to-pointer which
points to the first element of a one-dimensional pointer array,
where each pointer in that array points to a one-dimensional array
of objects. The pointer-to-pointer must be the same type as the
pointers and the objects.
For a three-dimensional array you need a
pointer-to-pointer-to-pointer. And so on. Each additional dimension
simply adds a new level of indirection, and a new level of
one-dimensional pointer arrays.
Of course multi-dimensional arrays are only useful if every
dimension is fully utilised and doesn't require too much in the way
of resizing. If that is not the case, then you may get more
efficient memory consumption from a vector of vectors (of vectors),
which allows dynamic resizing at every level without having to copy
existing elements. The downside is you lose the random access
provided by the array.

###### Asked in Computer Programming, Java Programming, C Programming

### What is linear array and explain its types?

What is ARRAY, explain its
types
ARRAY: -
It is the combination of same data type or if same data is
needed more then none time then we use array.
Types Normally there are two types of array.
(1) One dimensional array
(2) Two dimensional array
(1) One dimensional array: -
This array is in form a list (vertical\Horizontal) the data
input output or process in one dimensional array with the help of
loop.
The syntax of one dimensional array will be as:
Array name [strength]
For example
A [5];
The structure of above syntax will be as:
A (0)
A (1)
A (2)
A (3)
A (4)
(2) Two dimensional array: -
Two dimensional array is also called a table because it consist
of rows and columns. The syntax of two dimensional arrays will be
as:
Data type array name [rows] [columns]
For example
Int [3] [2];
The structure of above syntax will be as:
A [0] [0] A [0] [1]
A [1] [0] A [1] [1]
A [2] [0] A [2] [1]
The data input output are process in this array with the help of
nested loop.

###### Asked in Computer Programming, C Programming

### What is the importance of array in C programming?

Arrays allow similar types of data to be stored within a
contiguous block of memory such that every data element is
accessible in constant time, regardless of its physical location
within the array. This is achieved through simple pointer
arithmetic treating each element as a memory offset from the start
of the array. Since every element is the same length (in bytes),
locating any element is simply a matter of calculating its offset
from its index. Indices are zero-based thus the third element can
be found at index 2. The memory offset for that element is
therefore the product of the element size and 2. However, C permits
indices to be specified directly, while the pointer arithmetic is
done in the background. Thus array_name[2] automatically returns a
reference to the third element.
Arrays with large and complex variable length data elements need
to store those elements separately from the array, usually
non-contiguously. This is achieved by using a pointer array.
Pointer arrays are particularly useful when sorting extremely large
data lists as it is much easier and more efficient to implement a
sorting algorithm with an array than it is with a linked list,
particularly when constant-time random-access is essential to the
algorithm. The time and effort in building the array is generally
more than compensated for by the efficiency of the algorithm.
Arrays can also be divided and subdivided to better model the
data they represent. For instance, a chessboard might be
implemented as a one-dimensional array of 64 elements, however it
makes more sense to model the chessboard in a two-dimensional array
of 8x8 elements. Although the array is still allocated contiguously
and can be thought of as being 8 rows and 8 columns, it's actually
better to think of this two-dimensional array as being a
one-dimensional array of 8 elements, where each element is another
one-dimensional array of 8 elements.
By thinking this way it makes it possible to allocate extremely
large arrays in non-contiguous memory (as completely separate
one-dimensional arrays) and also makes comprehension of a
four-dimensional array in a three-dimensional world that much
easier (unless you actually want to model time and space of
course).
A four-dimensional array can be thought of in a variety of ways:
as being a one dimensional array of three-dimensional arrays, or as
a two-dimensional array of two-dimensional arrays, or as a
three-dimensional array of one-dimensional arrays, or even as a
one-dimensional array of one-dimensional arrays of one-dimensional
arrays of one-dimensional arrays. Whichever method you use to
imagine your array is immaterial, so long as it makes sense to you
that's all that really matters.

###### Asked in Computer Programming, Java Programming, C Programming

### What is an array of 8 by 4?

It is a two-dimensional array of 8x4 elements (32 elements in
total). You can also think of it as a one-dimensional array of 8
elements, where each element is itself a one-dimensional array of 4
elements. In other words, an array of arrays. Two-dimensional
arrays are best imagined as being a table of rows and columns. An
8x4 array therefore has 8 rows and 4 columns, where each row is an
an array of 4 elements.

###### Asked in Computer Programming, C Programming, Geometry

### What also called two dimensional arrays are?

I suppose you could refer to a two-dimensional array as a
rectangular or square array (or as a jagged array of not all arrays
within a given dimension have the same size). Table, grid or
matrix may also be good synonyms for two-dimensional
array, subject to the problem domain addressed with the
algorithm.