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

This is a discussion on coding done. Two minor bugs. where did I go wrong? within the C Programming forums, part of the General Programming Boards category; I got the program in place , but only two errors preventing me from compiling it.. line 63: left operand ...

  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!!!!
    Attached Files Attached Files
    • File Type: c ar2.c (5.7 KB, 66 views)

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,337
    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, 11:01 AM

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