Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
1.6k views
in Computer by (69.8k points)

What are Multidimensional Arrays? Using multidimensional array, write a program in C to sort a list of names in alphabetical order. 

1 Answer

+1 vote
by (69.2k points)
selected by
 
Best answer

Multidimensional array: Multidimensional arrays can be described as "arrays of arrays". For example, a bidimensional array can be imagined as a bidimensional table made of elements, all of them of a same uniform data type.

int arr[3][5]; represents a bidimensional array of 3 per 5 elements of type int.

Similarly a three dimensional array like int arr[3][4][2]; represent an outer array of three elements , each of which is a two dimensional array of four rows, each of which is a one dimensional array of five elements. 

Multidimensional arrays are not limited to two or three indices (i.e., two dimensional or three dimensional). They can contain as many indices as needed. However the amount of memory needed for an array rapidly increases with each dimension. For example: 

char arr [100][365][24][60][60];declaration would consume more than 3 gigabytes of memory.

Memory does not contain rows and columns, so whether it is a one dimensional array or two dimensional arrays, the array elements are stored linearly in one continuous chain. For example, the multidimensional array is stored in memory just like an onedimensional array shown below: 

int arr[3][4][2]= { 

Multidimensional arrays are just an abstraction for programmers, since we can obtain the same results with a simple array just by putting a factor between its indices.

printf("how namy names u want to enter");

scanf("%d",&n);

printf("enter names :\n");

for(i=0;i<n;i++)

scanf("%s",a[i]);

for(i=0;i<=n-2;i++)

{

for(j=0;j<n-i-1;j++)

{

if(cmp(a[j],a[j+1])>0) 

{

 cpy(b,a[j]); 

cpy(a[j],a[j+1]); 

cpy(a[j+1],b); 

}

}

}

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...