linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J." <mailing-lists@xs4all.nl>
To: linux-c-programming@vger.kernel.org
Subject: dynamic allocation of array of structures
Date: Sat, 22 Mar 2003 20:47:39 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.21.0303222034440.5699-100000@hestia> (raw)
In-Reply-To: <15992.37034.685358.775548@cerise.nosuchdomain.co.uk>

Hello,

struct {
 char *name;
 int telnr;
} people[100];

Instead of statically allocating an array of 100 of these structures like
I have done, I want to dynamically allocate the array at run-time and
resize the number of structures some where at any time in the main
program. 

I know how to resize char arrays and int arrays but I never (re)sized an
array of structres which can be accessed with something as: ``people[4].name''. 
In Google nothing really usefull turns up.

Can this be done without having to resort to other implementations like
linked lists etc.. ? If so how ?

Thank you in advance.

J.


  reply	other threads:[~2003-03-22 19:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-28  3:26 ODBC Under Linux chuckw
2003-02-28 21:31 ` Glynn Clements
2003-03-19 13:22   ` How to open a file and to disable other processes from removing it Alexi Jordanov
2003-03-19 15:45     ` Glynn Clements
2003-03-22 19:47       ` J. [this message]
2003-03-22 20:27         ` dynamic allocation of array of structures Anthony Nguyen
2003-03-22 20:48           ` J.
2003-03-22 21:00             ` Elias Athanasopoulos
2003-03-22 21:28               ` Glynn Clements
2003-03-22 21:44             ` dynamic allocation of array of structures, Thnkx J.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.21.0303222034440.5699-100000@hestia \
    --to=mailing-lists@xs4all.nl \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).