Thread: Quick Warning Question

  1. #1
    Registered User
    Join Date
    Apr 2008

    Quick Warning Question

    My program works perfectly (WOOHOO!!!!)

    Just one little warning I'm getting:

    countWords.c:57: warning: passing argument 4 of qsort from incompatible pointer type
    Line 57:
    qsort( hte_array, HT_getNrOfElements(), sizeof(HT_Element), compar_HTelements);
    And my function:
    int compar_HTelements(HT_Element *pa, HT_Element *pb)
      if ( (*pb).count != (*pa).count )
        return (*pb).count - (*pa).count;
        return strcmp( (*pa).word, (*pb).word );
    Why is the compiler giving a warning here? Why is it not valid?



  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    The fourth argument of qsort must be of the type int(void *, void *); and compar_HTelements is not of that type.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  2. Dev-cpp - compiler options
    By tretton in forum C Programming
    Replies: 7
    Last Post: 01-06-2006, 06:20 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Compiler "Warnings"
    By Jeremy G in forum A Brief History of
    Replies: 24
    Last Post: 04-24-2005, 01:09 PM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 05:46 PM