phatboislym

Untitled

Dec 28th, 2022
1,296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include "sort.h"
  2.  
  3. void bubble_sort(int *array, size_t size)
  4. {
  5.   int temp;
  6.   for (size_t i = 0; i < size; i++)
  7.   {
  8.     for (size_t j = i + 1; j < size; j++)
  9.     {
  10.       if (array[i] > array[j])
  11.       {
  12.         temp = array[i];
  13.         array[i] = array[j];
  14.         array[j] = temp;
  15.         print_array(array, size);
  16.       }
  17.       else
  18.         continue;
  19.     }
  20.   }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment