1. Engineering
  2. Computer Science
  3. pointer as function parameters c...

Question: pointer as function parameters c...

Question details

Pointer as Function Parameters (C++)
2 using namespace std; 4 // add prototype for swap function here 7 II add prototype for array print function here 10 // add prototype for bubble sort here 12 13 int mainO 14 15 16 int y 7; 17 int nums [5] 4,57,10,11,623 18 19 20 11 call swap function here 21 int x5; cout << x << << y << endl; 23 24 25 26 27 28 29 // call print functon here for the array nums I/ call bubble function here for the array nums 31 32 Icall print functon again here for the sorted array nums 34 35 36 37 38 39 40 // create swap funtion here 41 43 // create bubble sort function here 46 II create print function here 47
Assignment 1 Create a swap function that swaps the value of two integer variables. int x = 5; Input 1 and 2 are pointers for the integer variables The swap function is a void function. Once the swap is over, print out the value of the two variables cout <<x <<<y << endl; Assignment 2: · input 1 and Z are pointers tor the integer variables The swap function is a void function. Once the swap is over, print out the value of the two variables cout << x << << y << endl; Assignment 2 Create a function that prints out the values of an int array The 1st input to the function is the starting address of an int array The 2nd input to the function is the size of the array Assignment 3 Create a function that uses bubble sort to sort the values of an int array from high to low. The 1st input to the function is the starting address of an int array · The 2nd input to the function is the size of the array Use the following int array int nums [5(4,57,10,11,62): to demonstrate the use of your print function and bubble sort function.
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution