70 likes | 97 Views
Introduction to Arrays. An array is collection of items stored at contiguous memory locations. The idea is to store multiple items of same type together.
E N D
Introduction to Array ShomilBansal Asst. Prof. IIMT College of Management, Greater Noida
What is Arrays? • An array is a group of consective memory locations with same name and data type. • Simple variableisasinglememory locationwithuniquenameandatype. But an Array is collection of different adjacent memory locations. All these memory locations have one collective name andtype. • The memory locations in the array are known as elements of array. Thetotal number of elements in the array is calledlength. • The elements of array isaccessed with reference to its position in array, that is call index orsubscript.
Advantages / Uses ofArrays • Arrays can store a large number of value with singlename. • Arrays are used to process many value easily andquickly. • The values stored in an array can be sortedeasily. • The search process can be applied on arrayseasily.
Types ofArrays: • One-DimensionalArray • Two-DimensionalArray • Multi-DimensionalArray
One-DArray A type of array in which all elements are arranged in the form of a listis known as 1-D array or single dimensional array or linearlist. Declaring 1-DArray: data_typeidentifier[length]; e.g: intmarks[5]; • Data_type: • Identifier: • Length: Data type of values to be stored in thearray. Name of the array. Number ofelements.
One-D arrayIntialization The process of assigning values to array elements at the time of array declaration is called arrayinitialization. Syntax: data_typeidentifier[length]={Listofvalues}; e.g: int array[5]={5,34,12,96,49}; • Data_type: • Identifier: • Length: Data type of values to be stored in thearray. Name of the array. Number ofelements oList of values: Values to initialize the array. Initializing values must be constant
Greater Noida Campus IIMT Group of Colleges Plot No. 20-A, Knowledge Park III, Greater Noida, U P Tel: 0120 232 2655, 247 5000 Mob: 9911009144 Mob: 9717015300 Email: enquires@iimtindia.net Thank You!!! REACH US 1. College website : www.iimtindia.net 2. College Social Media Links : https://www.facebook.com/iimtmeerutgreaternoida/ https://www.youtube.com/iimt-group-of-colleges https://www.instagram.com/iimtindia/