[c] What is your favorite C programming trick?

I'm a fan of xor hacks:

Swap 2 pointers without third temp pointer:

int * a;
int * b;
a ^= b;
b ^= a;
a ^= b;

Or I really like the xor linked list with only one pointer. (http://en.wikipedia.org/wiki/XOR_linked_list)

Each node in the linked list is the Xor of the previous node and the next node. To traverse forward, the address of the nodes are found in the following manner :

LLNode * first = head;
LLNode * second = first.linked_nodes;
LLNode * third = second.linked_nodes ^ first;
LLNode * fourth = third.linked_nodes ^ second;

etc.

or to traverse backwards:

LLNode * last = tail;
LLNode * second_to_last = last.linked_nodes;
LLNode * third_to_last = second_to_last.linked_nodes ^ last;
LLNode * fourth_to_last = third_to_last.linked_nodes ^ second_to_last;

etc.

While not terribly useful (you can't start traversing from an arbitrary node) I find it to be very cool.