Computer Science, asked by farhaalrafa, 9 months ago

how many ways you can set values for an one dimensional integer array?

Answers

Answered by nirbhulachnayak
1

Answer:

The variable allows us to store a single value at a time, what if we want to store roll no. of 100 students? For this task, we have to declare 100 variables, then assign values to each of them. What if there are 10000 students or more? As you can see declaring that many variables for a single entity (i.e student) is not a good idea. In a situation like these arrays provide a better way to store data.

What is an Array?

An array is a collection of one or more values of the same type. Each value is called an element of the array. The elements of the array share the same variable name but each element has its own unique index number (also known as a subscript). An array can be of any type, For example: int, float, char etc. If an array is of type int then it’s elements must be of type int only.

To store roll no. of 100 students, we have to declare an array of size 100 i.e roll_no[100]. Here size of the array is 100 , so it is capable of storing 100 values. In C, index or subscript starts from 0, so roll_no[0] is the first element, roll_no[1] is the second element and so on. Note that the last element of the array will be at roll_no[99] not at roll_no[100] because the index starts at 0.

Explanation:

HOPE THIS ANSWER IS HELPFUL

Answered by kriselledsouza25
0

Mark me as the Brainliest I will be thankful to you

The variable allows us to store a single value at a time, what if we want to store roll no. of 100 students?

For this task, we have to declare 100 variables, then assign values to each of them.

What if there are 10000 students or more?

As you can see declaring that many variables for a single entity (i.e student) is not a good idea. In a situation like these arrays provide a better way to store data.

What is an Array?

An array is a collection of one or more values of the same type. Each value is called an element of the array. The elements of the array share the same variable name but each element has its own unique index number (also known as a subscript). An array can be of any type, For example: int, float, char etc. If an array is of type int then it’s elements must be of type int only.

Similar questions