Thewordmarksisthenameofarray

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: this purpose as : int marks[10]; This statement reserves ten locations in memory for storing elements Here int specifies the type of elements or items that will be stored in the array. The word marks is the name of array. [10] indicates the number of locations or the number of variables of type int in which data elements are to be stored which all should be integer type. It will look like in memory as 0 marks 1 2 3 4 5 6 7 8 9 The Bounds The Bounds The lower bound for an array in C language is ‘0’ and upper bound is size­1. So marks[10] means marks[0] through marks[9] i.e. 0 to 9 ten locations. Subscript numbers 0 1 2 3 4 5 6 7 8 9 marks The Subscript The integer values in brackets are known as subscripts which is used to distinguish one location from the other. The subscript actually specifies the position of element in an array, the last array element will have subscript one less than the size of the array. In this case, size of array is 10 and the last subscript is [9]. Storing/Inputting values in Arrays Storing/Inputting values in Arrays For e...
View Full Document

Ask a homework question - tutors are online