Wat is an array? give d declaration of one dimensional array with example
Answers
Answered by
0
An array is a collection of data that holds fixed number of values of same type. For example: if you want to store marks of 100 students, you can create an array for it.
float marks[100];
The size and type of arrays cannot be changed after its declaration.
For example,
float mark[5];
Here, we declared an array, mark, of floating-point type and size 5. Meaning, it can hold 5 floating-point values.
You can access elements of an array by indices.
Suppose you declared an array mark as above. The first element is mark[0], second element is mark[1] and so on.
float marks[100];
The size and type of arrays cannot be changed after its declaration.
For example,
float mark[5];
Here, we declared an array, mark, of floating-point type and size 5. Meaning, it can hold 5 floating-point values.
You can access elements of an array by indices.
Suppose you declared an array mark as above. The first element is mark[0], second element is mark[1] and so on.
Similar questions