I don't have a State
class so I replaced it with an int.
this is my code:
union Ptrlist
{
Ptrlist *next;
int *n;
};
int main(int argc, char** argv)
{
Ptrlist *l = new Ptrlist;
// I'm using a way c++ allocated memory here, you can change it to malloc.
l->n = new int;
*(l->n) = 10;
// Because you used an union, n's and next's addres is same
// and this will output 10
printf("%d", *(l->next));
getch();
return 0;
}
So in this way, n's value is initialized to 10