Question: Write the definition of a function named reverse that takes two parameters: an integer array and the number of elements of the array. The function

Write the definition of a function named reverse that takes two parameters: an integer array and the number of elements of the array. The function should reverse the order of elements of the array. The function should not return anything. See below for an example of expected outcome when the reverse function is called:

code:

int nums[] = {10,20,30,40,50}; reverse(nums, 5);// The order of elements should be reversed after this for(int i=0;i<5;i++) cout<< nums[i]<<" " 

output should be 50 40 30 20 10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!