subject

Your colleague developed a function, which is supposed to reverse an array of integers, e. g., {1, 5, -10, 7, 23} => {23, 7, -10, 5, 1}. Test cases show that the function does not work correctly. Please look at the following code and identify all the troubles. Please specify which part(s) of the code will not work and explain why not. void ReverseArray(int arr[], size_t elements_no) {
size_t i = 0; int x = 0; for (i = 0; i <= elements_no; i++)
{ x = arr[i]; arr[i] = arr[elements_no - i]; arr[elements_no - i] = x; }

}

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:00, dondre54
in 2007, floridians died in alcohol-related collisions.a.  501b.  1,051c.  5,015d.  10,839
Answers: 1
image
Computers and Technology, 22.06.2019 16:30, aryal191
Primary tech skills are skills that are necessary for success in online education
Answers: 3
image
Computers and Technology, 23.06.2019 15:30, yanicas
Hey so i was just trying out some game hacks so i took a paste from online and built it in my visual studio and then suddenly my computer was working or clicking on stuff on its own am i hacked?
Answers: 1
image
Computers and Technology, 23.06.2019 17:20, Morehollie9428
What is the best assassins creed game?
Answers: 2
You know the right answer?
Your colleague developed a function, which is supposed to reverse an array of integers, e. g., {1, 5...

Questions in other subjects: