Arrays are specified using a square bracket (int marks[]) and individual elements in an array can be referred to by their index:
marks[21] = 68;Because the index is just an integer value, we can always use a variable to represent the index so that we can parse through the array elements one by one.
marks[14] = 79;
for(int i=0; i<marks.length; i++)
{
marks[i] = 0;
}
No comments:
Post a Comment