how do you put struct pointers into functions?

Discussion in 'C' started by SORAKH2756, Sep 4, 2010.

  1. SORAKH2756

    SORAKH2756 New Member

    Joined:
    Sep 4, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    This is my struct

    Code:
    typedef struct{
    char first[20];
    char last[20];
    int nums[6];
    }RECORD; 
    
    this is my function prototype

    void writeRecord (RECORD* , FILE*, int);
    this is my functions


    Code:
    void writeRecord (RECORD* people, FILE* fp, int num_people){
    ...................
    } 
    in my main i put
     	Code:
     	RECORD* people;
    
    people = (RECORD*) malloc(num_people*sizeof (RECORD));
    
    writeRecord(people, fp, num_people); 
    
    can you guys tell me where i'm going wrong.

    these are the errors i get in microsoft visual c++ 2008

    these all point to the prototype
    syntax error: ')'
    syntax error: ','
    syntax error: missing ')' before '*'
    syntax error: missing '{' before '*'

    these point to the function
    writeRecord: redifinition; different basic types
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice