Thread: struct pointer to function syntax

  1. #1
    ... kermit's Avatar
    Join Date
    Jan 2003

    struct pointer to function syntax

    here is my code:

    int main(void)
        struct money {
    	char category[30];
    	char month[5];
    	int day;
    	char purchase_description[30];
    	float purchase[30];
        struct money money_log[MAX];
        struct money *p_money_log;  
        p_money_log = &money_log[0];
    What I want to do is have the pointer to the structure passed to different functions, however I have not been able to find a suitable example of the syntax for the function call. Do I have to use the keyword struct in the argument list? Or can I just do something like:

    void some_func(*p_money_log)
    I actually know this is incorrect - as there is no data type in the parameter list. Suggestions on how to pass the pointer are welcome. Thanks.


  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    void function( struct mystruct *myptr );
    Is that what you're trying to do?

    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Jul 2003
    void some_func(struct money *p_money_log)
    /* pointer to the pointer */
    void another_func(struct money **pp_money_log)
    int main(void)
         struct money *p_money_log;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 05-13-2011, 08:28 AM
  2. Link List math
    By t014y in forum C Programming
    Replies: 17
    Last Post: 02-20-2009, 05:55 PM
  3. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 02:49 PM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 09:33 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
Website Security Test