Page 1 :
Array, 1. What is an array?, An array is a simple data structure that can store similar data in contiguous memory locations., 2. What are the properties of an array?, a. An array size will depend on the total number of elements in it., b. The first memory location of an array is the smallest memory location., c., , By using the index values in an array any element in it can be accessed randomly., , 3. What are the advantages of array?, a. To get access to data we need to write less amount of code., b. Any element can be accessed randomly., c., , Quickly traverse an array, , d. Sorting the elements in an array is very easy., 4. What are the disadvantages of an array?, a. Fixed size, b. Cannot store different types of elements, 5. Declaring an array:Syntax:, Datatype variable_name[size_of_array];, Ex: int a[5];, 6. Initializing an array:, Syntax: name_of_the_array[index_position]=value;, a[0]=10;, a[1]=20, a[2]=30, a[3]=40, a[4]=50, 7. Another method of initializing an array, int x[5]={10,20,30,40,50} // This is called declaration and initialization, in the above method it is not necessary to mention the size of the array because we are already, initializing the array with values., Values, , 10, , 20, , 30, , 40, , 50, , Index, 0, 1, 2, 3, 4, position, To print the value at 4th index position: printf(“The value are 4th index position is: %d”,a[4]);