Thread: coding done. Two minor bugs. where did I go wrong?

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    1

    coding done. Two minor bugs. where did I go wrong?

    I got the program in place , but only two errors preventing me from compiling it..

    line 63:
    left operand must be modifiable lvalue: op "="
    line 66:
    left operand must be modifiable lvalue: op "="
    cc: acomp failed for ar2.c

    Where did I go wrong? Please see attached
    Please help...Thank you very much!!!!

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    char* temp[] = {NULL};
    
    if ( temp != NULL )
    You need to use a specific array index. Personally, 'char *temp[] = { NULL };' is a BadThing(TM), but that's just me.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Mmm - code looks remarkably like my answer here

    And you can't even copy that correctly.

    For a start, the dictionary is
    char **dictionary = NULL;
    NOT
    char *dictionary[];

    And you've totally messed up the sizes in the realloc call - you're trying to allocate more pointers, not more chars.

    It seems you're using a C++ compiler to compile this C code - how else would you explain all the unnecessary casts.

    add_word calls dup_string TWICE

    int compare_fn ( const void *a, const void *b );
    You've got a prototype, and you call it, but there's no code....

    Personally, I'd rip out most of the code and start with a simple stub (say my example), then add ONE function at a time, and make damn sure it compiles and runs OK before adding more code.

    Big Bang (write everything and hope someone on a message board will fix it) does not work.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 03-20-2009, 05:22 PM
  2. Coding Guideline ....!!
    By imfeelingfortun in forum Tech Board
    Replies: 8
    Last Post: 10-08-2006, 07:09 AM
  3. coding
    By rick1984 in forum C Programming
    Replies: 8
    Last Post: 07-29-2003, 04:23 AM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 12:01 PM