qucik sort

This is a discussion on qucik sort within the C Programming forums, part of the General Programming Boards category; in this quick sort code what is the int *pItem for? when it's compiled it gives an unreferenced local variable ...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    9

    Question qucik sort

    in this quick sort code what is the int *pItem for?
    when it's compiled it gives an unreferenced local variable warning.
    just confused....
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    int compare (const void * a, const void * b)
    {
      return ( *(int*)a - *(int*)b );
    }
    
    int main ()
    {
      int values[] = { 40, 10, 100, 90, 20, 25 };
      int * pItem;
      int n;
      qsort (values, 6, sizeof(int), compare);
      for (n=0; n<6; n++)
      {
        printf ("%d ",values[n]);
      }
      return 0;
    }

  2. #2
    Registered User Vber's Avatar
    Join Date
    Nov 2002
    Posts
    807
    it's because you aren't using int * pItem; delete this and it wont give you warning

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    9
    I figured. It's just that they had it in the example here. I thought there must be some reason why they stuck it in there and that's what confused me....

    Thanks...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Straight Insertion Sort function problem
    By StaticKyle in forum C++ Programming
    Replies: 6
    Last Post: 05-12-2008, 05:03 AM
  2. threaded merge sort
    By AusTex in forum Linux Programming
    Replies: 4
    Last Post: 05-04-2005, 05:03 AM
  3. Sorting
    By vasanth in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 11-10-2003, 05:21 PM
  4. Bubble Sort, Qucik Sort
    By insomniak in forum C Programming
    Replies: 2
    Last Post: 03-15-2003, 04:54 PM
  5. Shell Sort vs Heap Sort vs Quick Sort
    By mackol in forum C Programming
    Replies: 6
    Last Post: 11-22-2002, 08:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21