Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8503681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:49:18+00:00 2026-06-11T01:49:18+00:00

typedef struct { int id; char* first; char* last; }* person; person* people; Hi.

  • 0
typedef struct
{
int id;
char*  first;
char* last;
}* person;

person* people;

Hi.
How can I use this above, all set globally, to fill people with different “person”s? I am having issues wrapping my head regarding the typedef struct pointer.
I am aware pointers are like arrays, but I’m having issues getting this all together…

I would like to keep the above code as is as well.

Edit 1: char first should be char* first.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:49:19+00:00Added an answer on June 11, 2026 at 1:49 am

    You could simply create an array of structures of type person using something like following:

    people = malloc (num_person * sizeof(person));
    for (i = 0; i < num_person; i++) {
         people[i]->first = malloc (size * sizeof(char));
         people[i]->last = malloc (size * sizeof(char));
    }
    

    Following this, you could fill up each people struct with different parameters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my c++ struct (Use Multi-Byte Character Set) typedef struct hookCONFIG { int
Let's say I have a first structure like this: typedef struct { int ivalue;
typedef struct unit_class_struct { char *name; char *last_name; } person; int setName(person *array) {
I have this struct typedef struct grade { char firstName[SIZE]; char lastName[SIZE]; int stuNum;
OK, this is the definition of the struct: typedef struct { int first; int
I have declared the following struct: typedef struct _RECOGNITIONRESULT { int begin_time_ms, end_time_ms; char*
I have a structure typedef struct store { char name[11]; int age; } store;
I have these structs: typedef struct _Frag{ struct _Frag *next; char *seq; int x1;
I am curious why this code works: typedef struct test_struct { int id; }
typedef struct Model { int recordId; char *name; }Model; typedef struct ModelArray { //keeps

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.