asked 127k views
5 votes
Which statements about the enhanced for loop are true for arrays of primitive data? I. It is suitable for all array algorithms. II. It does not allow the contents of the array to be modified. III. It does not require the use of an index variable.

asked
User Lumnezia
by
8.8k points

1 Answer

2 votes

Answer: III

Explanation: An enhanced for loop is the foreach equivalent in .NET, you do not require a index variable.

E.x

Foreach(string str in foo[100]){ // prints all 100 strings in foo, one by one.

Console.WriteLine(str);

}

answered
User Alexmcchessers
by
8.5k points