Explain the declaration of multi dimensional arrays, C/C++ Programming

Assignment Help:

Explain the Declaration of Multi Dimensional Arrays?

In the figure, the range in the first dimension is 3 and in the second dimension is 4. The shaded portion corresponds to the element a [2][2]. While initializing a 2D array, it is necessary to mention the second dimension (example. column) whereas the first dimension is optional.

772_Multi Dimensional Arrays.png

Therefore in the declarations shown below: - 'a' and 'b' are right whereas 'c' is wrong

a. static in a[3][3]={
{0,1,2},
{3,4,5},
{6,7,8}
};
b. static int a2 [][3] = {10,4,9,8,2.3} ;
c. static int a3 [][] = {10,4,9,8};]'
d. static int al [2][2] = {10,4,9,8} ;

A multidimensional array is as well possible. For illustration a 3-D array can be written as int a [3][2][2]. For identify an element of this array 3 subscripts will be needed for example a[m][n][p]. The first subscript specifies a plane number and the next two specifies the column and the row. The three-dimensional array is an array containing spatial information, which is able to be indexed by latitude, longitude and altitude.

For specifying an element of an n subscripts, n dimensional array are needed sometimes the geometric analogy breaks whenever go beyond 3-D. Still C programming language permits arbitrary number of dimension.


Related Discussions:- Explain the declaration of multi dimensional arrays

Expression in c++, expression and its types with example programs

expression and its types with example programs

Explain destructors, Destructors A destructor function gets implemented...

Destructors A destructor function gets implemented whenever an instance of the class to which it belongs goes out of existence. The primary usage of a destructor function is

Super ascii string cost, want the codings for these topic in ur experts min...

want the codings for these topic in ur experts minds.com

Wap avgerage score-assignment- standard deviation of student, finds the ave...

finds the average for all assignments for an individual student float getAverageForStudent(float scores[20][10], int student, int numAssignments) {  }  // finds the average for

Program that will recursively prompt for input from the user, BACKGROUND: F...

BACKGROUND: FILE SYSTEMS  In a computer, a file system (sometimes written filesystem) is the way in which files are named and where they are placed logically for storage and ret

Can you think of a condition where your program would crash , Can you think...

Can you think of a condition where your program would crash without attaining the breakpoint that you set at the starting of main()? A: C++ let for dynamic initialization of glo

Tree, Write algorithm and program for the conversion of a Tree to a Binary ...

Write algorithm and program for the conversion of a Tree to a Binary Tree

#task1, program for factorial

program for factorial

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd