15.9k views
2 votes
What does the following code do? Assume list is an array of int values, temp is some previously initialized int value, and c is an int initialized to 0. for (int j = 0; j < list.length; j++) if (list[j] < temp) c++;

User Tyann
by
5.6k points

1 Answer

4 votes

Answer:

The folowing code counts the number of elements in list that are less than temp.

Step-by-step explanation:

Because an array is an object that stores many values of the same type. An array element is one value in array. An array index is an integer indicating a position in an array. Like strings, arrays use zero base indexing, that is array indexes start with 0(zero).

User Masylum
by
5.3k points