Anyway to achieve the following

pilger abcd at dcba.com
Fri Aug 13 19:40:55 UTC 2021


On Friday, 13 August 2021 at 19:06:17 UTC, JG wrote:
> Anyway I hope it is clearer what I mean. Is it possible to do 
> this in d?

union S
{
   int x;
   int a;
}

void main()
{
    S s= S(1234);

    writeln(s.a); //displays 1234
    s.x = s.x+1;
    writeln(s.a); //displays 1235
    s.a = s.a +1;
    writeln(s.a); //displays 1236
}



More information about the Digitalmars-d-learn mailing list