XOR linked list implementation
long both;


Using a long for storing a cast pointer can be both wasteful and too little. Just use the dedicated uintptr_t. Even if your implementation might not be fully up to C99 (MS greets), it probably has &lt;stdint.h&gt; and the typedef.

pStNode newNode = (StNode *) malloc(sizeof(StNode));

The above line demonstrates three bad ideas:

More pieces to keep track of means more complexity, which is bad. Thus hiding pointers behind typedefs is a bad idea, unless that pointer-type is never dereferenced, and is thus the one true type used.

Casting a void* is superfluous and error-prone.
See &quot;Do I cast the result of malloc?
&quot;.

Don't use sizeof(TYPE) unless unavoidable. Getting it right even if the types aren't obscured is error-prone. Just use sizeof *pointer.


pStNode get(pStNode headNode, int index)


There is a type uniquely suited as an index: size_t. Alternatively, if you want something signed, you might be interested in ptrdiff_t. Though yes, if your use-case guarantees few enough nodes, int might work.

You really should encapsulate your list somehow. Currently, you are creating a one-off in main().
Also, cleanup should be possible without terminating the program.

If you use at least C99, main() has an implicit return 0;.