Arrays Introduction

description of image


Create Arrays


The syntax to create an array Is:


dataType[] arrayName;


For example,


Int[] data;


Here, data is an array that can hold values of type int. The number of values that this array can hold is unknown at the moment.


To define the number of elements that an array can hold, we need to allocate memory for the array.



Example: Access Array Elements


● This program prints the index values



Quiz


Question Text