Thread: linked list error

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    28

    linked list error

    i have a defined a struct that looks like this:

    //code:
    struct record
    {
    char name[25];
    char address[80];
    int yearofbirth;
    char telno[15];
    };
    //endcode

    i am trying to create a linked list of records, and am unable to allocate memory on the heap for the list.

    this line of code is giving me some divine errors:

    //code:
    record *start;
    start = malloc(sizeof(record));
    //endcode

    the error says this:
    cannot assign void* to record*

    i know what this means, but i have no idea how to remedy the problem.

    does anyone have some input so that i can finally get some rest today???
    eat, drink and be merry. for tomorrow: we party.

  2. #2
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    start = (record *) malloc (sizeof (record));
    hello, internet!

  3. #3
    Registered User
    Join Date
    Aug 2002
    Posts
    28

    oh my.

    oh my, that error disappearing was the best rabbit that a magician could pull out of their hat....

    ...thank you so very much...i will a wonderful two hours of sleep tonight...if i can get the rest of the list to function correctly...

    *sigh*
    eat, drink and be merry. for tomorrow: we party.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  2. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  3. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  4. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 08:11 AM
  5. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM