Advertisement
Mixilino

bubble sort

Apr 20th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. void sortirajNiz(ARRAY_100 x, int n)
  2. {
  3.         int i, j, temp;
  4.         for (i = 0; i < n - 1; i++) {
  5.             for (j = 0; j < n - i - 1; j++) {
  6.                 if (x[j] > x[j + 1]) {
  7.                     temp = x[j];
  8.                     x[j] =x[j + 1];
  9.                     x[j + 1] = temp;
  10.                 }
  11.             }
  12.         }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement