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

Draw pie chart in c++ program, Draw pie chart in c++ program: int main...

Draw pie chart in c++ program: int main() {                 char cmd;                   cout                 cout                 cmd = toupper(getch());

Write the statements which are used to connect php, Write the statements wh...

Write the statements which are used to connect PHP with MySQL? Statements which can be used to connect PHP with MySQL is: $conn = mysql_connect('localhost'); echo $co

Calculate and display the marks and grade for each student, In this assignm...

In this assignment you are required to develop a program that allows the creation, viewing and storage of information about ITECH7603 Students. In order to complete the task you ha

How does a structure differ from an array, Question : (a) What is a str...

Question : (a) What is a structure? Provide a simple example of your own to illustrate this feature. (b) How does a structure differ from an array? (c) Describe a structu

C++ Program Please see where i do mistake, #include #include #include ...

#include #include #include #include #include class Employee { private: char *Name; //Set them as pointers... int IdNumber; char *Department; char *Position; public: voi

Padovan string, padovan string generation till 40

padovan string generation till 40

Write a function that computes the total interest charged, You are going to...

You are going to write a function that computes the total interest charged on a credit card before it is paid off. List all the inputs the function will need.

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