Ques.: Passing Ascending and Descending Function As Argument
Ques.: Passing Ascending and Descending Function As Argument
int main()
{
int choice;
int i;
int a[ SIZE ] = { 2, 6, 4, 8, 10, 12, 89, 68, 45, 37 };
if(choice == 1){
bubbleSort(a, SIZE, ascending);
}else if(choice == 2){
bubbleSort(a, SIZE, descending);
}else{
printf("invalid input");
}
}
int ascending(int a,int b){
return a > b;
}
int descending(int a,int b){
return a < b;
}
ScreenShot:-