Menu
Coddy logo textTech

Reverse Sort

Lesson 8 of 11 in Coddy's Bubble Sort course.

challenge icon

Challenge

Easy

Create a function named reverse_sort that receives an array and size of the array. Sort the array in reverse order using bubble sort algorithm. Return the final array.

For example,

Given Input: [2,4,1,2,3]

n=5

Output: [4,3,2,2,1] 

Try it yourself

#include <stdio.h>
#include <stdlib.h>

int* reverse_sort(int* arr, int arr_size, int n, int* returnSize) {
    // Write code here
    *returnSize = n;
    return arr;
}

All lessons in Bubble Sort