Question: Write a generic macro swap which can be used for any data types like integer, float, pointer.

Solution: Pass type information along with address(. Treat this macro as textual replacement while coding)
#define mySwap(type_t, p, q)\
{ \
type_t temp = *(type_t *)p; \
*(type_t *)p = *(type_t *)q; \
*(type_t *)q = temp; \
}

mySwap(int, &a, &b);