Inserting Compile error ......

This is a discussion on Inserting Compile error ...... within the C Programming forums, part of the General Programming Boards category; Friends; Just help me. I became unable during thesepast more than weeks to solve my Circular Linked List program, although ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    11

    Inserting Compile error, Help me ......

    Friends;
    Just help me. I became unable during thesepast more than weeks to solve my Circular Linked List program, although I did it simply linked List.
    Just send me, initializenode(), insertnode() and printnode() functions for CIRCULAR LINKED LIST. I think then, Iwill be able to make delete, save, modify and search functions......

    For references you can see my previous posts and my overall program, ...Modify it if anyone can .......

    // struct type ...
    struct node {
    char name[20];
    int id[10];
    struct node *next;
    } List;

    // function prototype ....

    void insertnode( List *)
    main()
    .....

    void insertnode( List *insert )
    {
    List *cur, *tail;
    List *myList;
    cur = tail = myList;
    do {
    if(strcmp(cur->name,insert->name)<0)
    {
    cur = cur->next;
    }
    else
    break;
    } while(cur != tail);
    /* insert after the end */
    if ( cur == tail)
    {
    insert->next = myList;
    tail->next = insert;
    }
    /* insert after cur */
    else
    {
    insert->next=cur->next;
    cur->next=insert;
    }
    }

    ***COMPILE ERROR Message ****
    parse error before `*'
    mycll.c:69: parse error before `*'
    mycll.c: In function `insertnode':
    mycll.c:71: `cur' undeclared (first use in this function)
    mycll.c:71: (Each undeclared identifier is reported only once
    mycll.c:71: for each function it appears in.)
    mycll.c:71: `tail' undeclared (first use in this function)
    mycll.c:72: `myList' undeclared (first use in this function)
    mycll.c:75: `insert' undeclared (first use in this function


    Can again anyone point where I did mistake......

    BYE!!!!
    Last edited by yescha; 12-01-2001 at 06:40 AM.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    375
    Well, the first parse error which caused the other errors is somewhere in your ... code. It is probably a semicolon you missed, or perhaps an ending } (or beginning {).
    Allegro precompiled Installer for Dev-C++, MSVC, and Borland: http://galileo.spaceports.com/~springs/

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,505
    Yeah, like this prototype needs a ;

    // function prototype ....
    void insertnode( List *)

    > Can again anyone point where I did mistake
    Not pressing the compile button sooner.

    Writing 100+ lines of code without compiling is just asking for lots of error messages. It's pretty easy to write 10 lines of syntactically valid code, then compile it. If you get some errors, you've only got the last 10 lines to worry about.

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    22
    Hi,
    I think the problem is somewhere at your declaration part of structure varibles.

    Try to declare structure variables as below.
    struct List *cur, *tail;

    the above nomenclature has to be followed in all part of your code. Just try this.This is the convension in C, and i don't have any idea about C++ compiler.If you are having C compiler then the above said suggestion may solve your problem.

    By
    A.Sebasti..
    Last edited by sebastiraj; 12-01-2001 at 04:09 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 01:17 AM
  2. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  3. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 08:11 AM
  4. C++ compilation issues
    By Rupan in forum C++ Programming
    Replies: 1
    Last Post: 08-22-2005, 05:45 AM
  5. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 03:49 AM

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