What is wrong with the following code? double[] arr = { 1.1, 2.2, 3.3, 4.4, 5.5 }; for (int i = 0; 5 > i; ++i) std::cout
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
What is wrong with the following code? double[] arr = { 1.1, 2.2, 3.3, 4.4, 5.5 }; for (int i = 0; 5 > i; ++i) std::cout
What is wrong with the following code? double[] arr = { 1.1, 2.2, 3.3, 4.4, 5.5 }; for (int i = 0; 5 > i; ++i) std::cout << arr << std::endl; Select one: The declaration of the array type is incorrect — the [] must come after the variable name. The loop increment expression should be i++ to avoid potential out of bounds issues occurring from the effect of pre-increment. The loop condition should be i < 5. The for loop body is not enclosed within curly braces. оо
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!