Array Lists in C

ARRAY– Stores multiple items[Series of characters, multiple strings].

Array is declared in the form of;

int a[3][2]={ {1,4}, {5,2}, {6,5}

};

Declared array is of size 3*2.

This declared array contains total of 6 elements. Row1:  {1,4}, Row2:  {5,2}, Row3:  {6,5}.

Thus the array can be initialized row wise as well as sequentially.

Arrays are formulated as:

Type of array: Defines the type of element- Such as char, int , structure ec..
Name of array: Defines the name given to an array.
Number of element: Value inside the subscript”[]” gives the number of element.
Example: char arr[5];

Initialization:

* Initializing each element seperately

Example:

int arr[10]; int i; for [i=0;i c] boolean contains[Object o] E[] toArray[E[] a] Object[] toArray[]

  • List   [positional access, extends Collection], with methods:

    E get[int index] E set[int index, E element] void add[int index, E element] int indexOf[Object o] int lastIndexOf[Object o] E remove[int index] List subList[int fromIndex, int toIndex] ListIterator listIterator[] ListIterator listIterator[int index] boolean addAll[int index, Collection

  • Chủ Đề