What happend when we override union fields in C? : I am reading the implementation of Thompson algorithm for matching regular expression in C. [link][1]. I saw this snippet of code
```C
/*
 * Since the out pointers in the list are always 
 * uninitialized, we use the pointers themselves
 * as storage for the Ptrlists.
 */
union Ptrlist
{
	Ptrlist *next;
	State *s;
};

/* Create singleton list containing just outp. */
Ptrlist*
list1(State **outp)
{
	Ptrlist *l;
	
	l = (Ptrlist*)outp;
	l->next = NULL;
	return l;
}
```
But as I understand, in `union` type, all fields share the same memory. So why can we set `l->next=NULL` after casting `l=(Ptrlist*)outp;` because by doing that, we that that memory location to `NULL` and `l` will become `NULL`?

  [1]: https://swtch.com/~rsc/regexp/nfa.c.txt