"TaiwanNoWhere" <rudyliang@hotmail.com> wrote in message
news:d8b9947c.0310060645.215616a7@posting.google.c om...[color=blue]
> The problem is Schedule.TaskNumber will lose the value
> which I assigned by ++TaskNumber[/color]
That's because union members *share* storage (but not
dues). When you assign to Schedule[i].Length, you are
*overwriting* the storage used by the other members of
the union, and thus their values are no longer valid. It
looks to me like you want Task to be a struct, not a union.
Also, a static var declared inside main() is kinda funny,
since I believe main() is not re-entrant in C++. Then
again, you wrote "main(void)", so maybe it's supposed to
be a C program.
It really helps if you format your code nicely. Namely, use
proper indenting so loop structures and data structures
are obvious. Left-justified code is rarely read, hence
part of your difficulty in getting a useful response.
Dave
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.521 / Virus Database: 319 - Release Date: 9/23/2003