Results 1 to 10 of 10

Thread: [Resolved] Dynamic Array of Struct in C?

Threaded View

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Resolved [Resolved] Dynamic Array of Struct in C?

    If I had this:

    Code:
    typedef struct {
        char *name;
        int age;
    } PersonalInfo;
    
    //...
    
    PersonalInfo *userInfos;
    
    userInfos = (PersonalInfo *) calloc(1, sizeof(PersonalInfo));
    How would I access the members of userInfos? I've tried many combinations with . and -> but nothing seems to work. Plenty of errors and crashes.
    Last edited by The Hobo; Oct 10th, 2005 at 10:40 AM.
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width