3
answers
0
watching
118
views
brmLv1
21 Mar 2023
This is also in c program code.
To demonstrate pointers to functions, the sample output below shows the bubble-sort program. It consists of main and functions bubbleSort, swap, ascending, and descending. Function bubbleSort receives a pointer to a function as an argument—either function ascending or function descending—in addition to an int array and the array’s size. The user chooses whether to sort the array in ascending (1) or descending (2) order. If the user enters 1, the main passes a pointer to the function ascending to function bubbleSort. If the user enters 2, the main passes a pointer to the function descending to function bubbleSort.
This is also in c program code.
To demonstrate pointers to functions, the sample output below shows the bubble-sort program. It consists of main and functions bubbleSort, swap, ascending, and descending. Function bubbleSort receives a pointer to a function as an argument—either function ascending or function descending—in addition to an int array and the array’s size. The user chooses whether to sort the array in ascending (1) or descending (2) order. If the user enters 1, the main passes a pointer to the function ascending to function bubbleSort. If the user enters 2, the main passes a pointer to the function descending to function bubbleSort.
Liked by brm and 2 others
21 Mar 2023
Read by 2 people
21 Mar 2023
Already have an account? Log in
Read by 1 person
yournotesbuddyLv10
21 Mar 2023
Already have an account? Log in