Download presentation
Presentation is loading. Please wait.
Published byAlexandra Oliver Modified over 8 years ago
1
ARRAYS IN C/C++ (1-Dimensional & 2-Dimensional) Introduction 1-D 2-D Applications Operations Limitations Conclusion Bibliography
2
Introduction Array is a derived data type that represents a collection of the similar types of data with continuous memory locations with fixed size sequence. Roles Efficient storing of large volume of data Efficient access and manipulation of data Helpful in viewing complex problem in simpler way Single name for multiple data Structured Data Type
4
1-Dimensional Array Data_type var_name[Expression] Data Type is the type of elements to be stored in the array Var_name is the name of the array like any Other variables Expression specifies the number of elements to be stored In array Example : int num[10]; char city[9]= “HALDIA”; char city[9]={ ‘H’,’A’,’L’,’D’,’I’,’A’} Num[0] =data1 Num[1] =data2 Num[2] =data3 Num[3] =data4 Num[4] =data5 Num[5] =data6 Num[6] =data7 Num[7] =data8 Num[8] =data9 Num[9] =data10
5
2-DIMENSIONAL ARRAY 01234 0 1 2 3 4 01234 0 1 27 3 4 int matrix[5] [5]; matrix[2] [1] = 7 012 0123 1456 2789 3101112 int array [4][5]; or Int [][] array ={ {1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12} };
6
Applications Matrix Problem Solving different algorithms, graph & tree problem Sparse Matrix Storing and searching of large amount of data Stack, Queue Array of pointers, Dynamic Arrays
7
OPERATIONS IN ARRAY INSERTION DELETION MERGING TWO ARRAYS TRAVERSING SORTING SEARCHING
8
Limitations Wastage of memory space. We cannot change size of array at the run time. It can store only similar type of data. Sometimes it is not easy to operate with many index arrays.
9
Conclusion Array has added a new flavour to the programming, the efficiency of C language has reached to zenith in terms of efficient storing, accessing and manipulation of data, speed and reliability. Bibliography ANSI C by E Balagurusamy http://www.slideshare.net Wikipedia
10
Any Questions? Thank you!!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.