VEndymionV

Untitled

Oct 20th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. void sortowanie(Struktura **tab_s, int N) // Do poprawienia
  2. {
  3.     Struktura *temp = (Struktura*)malloc(sizeof(Struktura));
  4.     for (int i = 0; i < N; i++)
  5.     {
  6.         bool czy_posortowane = true;
  7.         for (int j = N-1; j > i; j--)
  8.         {
  9.             if (tab_s[j-1]->i > tab_s[j]->i)
  10.             {
  11.                 temp = tab_s[j-1];
  12.                 tab_s[j-1] = tab_s[j];
  13.                 tab_s[j] = temp;
  14.                 czy_posortowane = false;
  15.             }
  16.         }  
  17.         if (czy_posortowane) return;
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment