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

Program with inbuilt functions, write a atm program in c with inbuilt funct...

write a atm program in c with inbuilt functions for 1782?

What is the difference between javascript and php, What is the difference b...

What is the difference between JavaScript and PHP? The difference lies with the execution of languages. PHP is server side scripting language, which means that it cannot intera

Write a program to calculate the timetable, Write a program to calculate th...

Write a program to calculate the timetable for numbers 1 -> 10 and display them as follows. Your solution should use for do loops      #include stdio.h void main() {    char p

How to define a derived class, How to define a derived class ? A singly...

How to define a derived class ? A singly inherited derived class id defined by writing : The keyword class. The name of the derived class . A single colon (:).

Area under the curve, Write a program to find the area under the curve y = ...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

C program to print r diagonal triangle, C program to print R diagonal trian...

C program to print R diagonal triangle: #define rows 3 #define cols 3 void main() {                 int i=0,j=0;                 int arr[rows][cols];

Write a program for simulating jet-powered car acceleration, The absolute l...

The absolute land-speed record of 763.035 MPH (Mach 1.02) was set in October 15 1997 by a jet-powered car called Thrust SSC in the Black Rock Desert of northern Nevada. The team th

Explain nested classes, Nested Classes Many a times, it becomes essenti...

Nested Classes Many a times, it becomes essential to have a class contain properties of two other classes. One way is to explain a class within another - that is a class with m

Do i have to check for null after p = new fred()?, A: No. (Excluding if you...

A: No. (Excluding if you have an old compiler, you might have to force the new operator to throw an exception if it runs out of memory.) This turns out to be a real pain to alwa

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