title: quick sorting an array of structs using pointers
body: <p>My assignment is preforming quick sort on array of structs using pointers to the first and last elements of the array. This is the struct-</p>
  <pre><code>typedef struct Bus {
  int number, distance, time; } Bus;
  </code></pre>
  <p>At some point of the program, i have an array of user-defined number of these struct. My goal is to sort the array by the time (lowest to highest). The functions that i need to fill are-</p>
  <pre><code>void swap(Bus *a, Bus *b)    
  void quick_sort (Bus *start, Bus *end) 
  Bus *partition (Bus *start, Bus *end)
  </code></pre>
  <p>that's my implementation-</p>
  <pre><code>void swap(Bus *a, Bus *b)
  {
    Bus tmp = *a;
    *a = *b;
    *b = tmp;
  }
  
  void quick_sort (Bus *start, Bus *end)
  {
    long long n = end - start;
    if (n &gt; 2)
    {
      Bus * pivot = partition (start, end);
      quick_sort (start, (end-1));
      quick_sort ((start+1), end);
    }
  
  }
  
  Bus *partition (Bus *start, Bus *end)
  {
    long long n = end - start;
    int pivot = (end -1)-&gt;time;
    int i = start-&gt;time;
    int j = (end - 1)-&gt;time;
    for(;;)
    {
      
    }
  }
  </code></pre>
  <p>I got this far and didn't knew how to continue. I will appreciate your help.</p>
  <p>edit- Thats how i call the function from main- <code>quick_sort(arr, (arr + num_of_lines))</code> when num_of_lines is the size of the array.</p>