Array
- Similar objects are grouped.
- Its syntax is
- The items in an array are called elements.
- All type of elements of an array are of the same type.
- The first element of an array is numbered 0, so the last element is less than the size of the array.
Initializing Arrays:
- If you want to compile the specific values already fixed for the array.
int a[5]= {50, 25, 10, 5, 1}
int a[]= {50, 25, 10, 5, 1}
Here,
a[0]= 50, a[1]= 25, a[2]= 10, a[3]= 5, a[4]= 1
a[5]= {50, 25, 10, 5, 1}; // declaration of a new array
a[3]= 5; //access to an element of the array
- The compiler will count the number of items in the initialization list and fix that as the array size.
Thank you all..
0 comments:
Post a Comment