help please

This is a discussion on help please within the C Programming forums, part of the General Programming Boards category; Code: struct list{ float value; struct list *next_ptr; }; void init(struct list **ptrptr) { *ptrptr=NULL; } struct list disposizione_elementi(struct list ...

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    3

    help please

    Code:
      struct list{
               float value;
               struct list *next_ptr;
               };
               void init(struct list **ptrptr)
               {
                    *ptrptr=NULL;
                    }
    
    struct list disposizione_elementi(struct list *ptr,struct list next_ptr,float value)
       {
    
         struct list *tmp_ptr;
         while(ptr!=NULL)
         {
                         tmp_ptr=(ptr->next_ptr);
                         free(ptr);
                         ptr=(ptr->next_ptr);
                         }
       }
    could someone help me plz with this program, i'm using code block for complier..
    and he said me there are 3 error plz help thxx ^^

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    Well, you didn't post the errors so let me make some guesses.

    Code:
    struct list disposizione_elementi(struct list *ptr,struct list next_ptr,float value)
    This function says it returns a list, but nowhere in your code does it return anything.

    You don't have a main function.

    You are not including stdlib.h.
    bit∙hub [bit-huhb] n. A source and destination for information.

  3. #3
    Registered User
    Join Date
    Aug 2009
    Posts
    3
    hm sry ... i tryed to include stdlib.h

    now i have 2 error, they're:

    line 8: error : new types may not be definde in a return type
    line 8: error : tow or more data types in declaration of "init"

    line 8 is one with { exactly the 3rd one
    plz help me in any way i have to run this program is very important .

    p.s.:sry for my bad english T-T

  4. #4
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Show the full code, not just the functions. How are you calling them?
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  5. #5
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Code:
    struct list disposizione_elementi(struct list *ptr,struct list next_ptr,float value)
    I'd bet you left out the word "struct" somewhere else. Make sure that the prototype and definition for this function are exactly the same...

Popular pages Recent additions subscribe to a feed

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