Arrays
Arrays
LECTURE 21
BY: KAISER A SHIEKH
LECTURER COMPUTER SCIENCE
Array
• Array is a collection of homogenous data items at contiguous memory
locations under a single name separated by unique index.
• Array is a collection of same type of variables arr
• Syntax for declaration : 0 arr [0]
datatype ArrayName[size]; 1 arr[1]
2 arr[2]
• Example : arr[3]
3
int arr[10]; // creates an array of 10 integers 4 arr[4]
5 arr[5]
6 arr[6]
7 arr[7]
8 arr[8]
9 arr[9]
Array initialization
• Array initialization arr