Macro to swap any two variable int, char, float, struct etc..
/* Generic Swap macro*/
#define swap (a, b, type) {type t = a; a = b; b = t; }
Call the macro like this:
swap(a,b,int)
swap(a,b,str)
When curiosity outbursts …!!!
Macro to swap any two variable int, char, float, struct etc..
/* Generic Swap macro*/
#define swap (a, b, type) {type t = a; a = b; b = t; }
Call the macro like this:
swap(a,b,int)
swap(a,b,str)