The multidimensional arrays are supported by Objective-C programming language. The below statement shows the declaration of multidimensional array.
For example, the declaration of three-dimensional 5, 10, 4 integer array as follows:
In multidimensional array the simplest form is two-dimensional array. A two-dimensional array is a list of one-dimensional arrays. The below statement explains the declaration of two dimensional arrays:
In the above statement, type is a data type of Objective-C and arrayName is an Objective-C identifier. The below table is a two dimensional array, which will have x number of rows and y number of columns. A 2-dimensional array a, which contains three rows and four columns can be shown as below:
From the above table, Element in array “a” is identified by an element name of the form a[i] [j]. Where “a” is the name of the array, and “i” and “j” are the subscripts that uniquely identify each element in “a”.
Multidimensional arrays are initialized by specifying bracketed values for each row. The below example is an array with 3 rows and each row has 4 columns.
The nested braces, which indicate the intended row, are optional. The below statement is equivalent to previous example:
The elements in two dimensional arrays are accessed by using the subscripts, i.e., row index and column index of the array.
From the above statement it will take 4th element from the 3rd row of the array.
The below example explains the using of nested loop to handle a two-dimensional array:
On compiling and executing the above code, the following result is produced:
There for the arrays can be with any number of dimensions but mostly we create one or two dimension arrays.
Objective C Related Interview Questions
|Python Interview Questions||DBMS Interview Questions|
|C++ Interview Questions||IPHONE APPS Interview Questions|
|C & Data Structures Interview Questions||IOS Interview Questions|
|Java Interview Questions||Go (programming language) Interview Questions|
|F Sharp (programming language) Interview Questions||C preprocessor Interview Questions|
|R Programming language Interview Questions||D Programming Language Interview Questions|
|Lua (programming language) Interview Questions||Embedded C Interview Questions|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.