By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,918 Members | 2,258 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,918 IT Pros & Developers. It's quick & easy.

structure and pointers

P: n/a
i have a structure
typedef struct tm
{
int date;
int hour;
int minutes;
} time;

i want to use this structure dynamically, ie, i want it to grow.

like it would be
time *sept= new time;
sept->date=15;
......
.........
.......
but i want something like

for(int i=0;i<MAX;i++)
{
sept[i]->date=i+5;
}

i want to grow the structure dynamically, ie, the valur of MAX is
provided at runtime.
how can i do tht????

Sep 27 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ne*******@gmail.com wrote:
i have a structure
typedef struct tm
{
int date;
int hour;
int minutes;
} time;

i want to use this structure dynamically, ie, i want it to grow.

like it would be
time *sept= new time;
sept->date=15;
.....
........
......
but i want something like

for(int i=0;i<MAX;i++)
{
sept[i]->date=i+5;
}

i want to grow the structure dynamically, ie, the valur of MAX is
provided at runtime.
how can i do tht????
Sounds like std::vector< tm might be what you need. Read up on the
standard library and in particular the standard containers.
Best

Kai-Uwe Bux
Sep 27 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.