viod function with a argument that points to a struct

This is a discussion on viod function with a argument that points to a struct within the C Programming forums, part of the General Programming Boards category; how would you do that? Code: void foobar (struct *log); or is it done some other way?...

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    51

    viod function with a argument that points to a struct

    how would you do that?

    Code:
    void foobar (struct *log);
    or is it done some other way?

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,790
    Sure, it's the same as everything else:
    Code:
    return_type function_name(argument_type argument_name);
    Code:
    void foo(my_struct* my_arg);

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    242
    What do you mean?
    Code:
    typedef struct
    {
    int name;
    int familyname;
    } Names;
    
    int main(void)
    {
    int *pt;
    Names test;
    pt = &test; // This is how you point to a struct!
    return 0;
    }
    or you're talking about stating a point that is based on a struct?
    Last edited by eXeCuTeR; 10-26-2007 at 09:07 PM.

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Code:
    typedef struct
    {
    int name;
    int familyname;
    } Names;
    
    int main(void)
    {
    Names  *pt;
    Names test;
    pt = &test; // This is how you point to a struct!
    return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Style Points
    By jason_m in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 06:15 AM
  2. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 12:03 PM
  4. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 09:18 AM
  5. Possible Loss of data
    By silicon in forum C Programming
    Replies: 3
    Last Post: 03-24-2004, 11:25 AM

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