I believe you can only create generic types like that in C++ using templates. For you problem I would just have the programmer pass the macro three variables like so:
Code:
#include <stdio.h>
#include <string.h>
#define swap(x, y, z) (z) = (x); (x) = (y); (y) = (z);
int main()
{
int x = 0, y = 1, z;
float a = 2.0, b = 3.5, c;
printf("The value before swap of x= %i, y= %i\n", x, y);
swap(x, y, z);
printf("The value after swap of x= %i, y= %i\n", x, y);
printf("The value before swap of a= %f, b= %f\n", a, b);
swap(a, b, c);
printf("The value after swap of a= %f, b= %f\n", a, b);
getchar();
return 0;
}
I will look around some more and see if I can find a reference to templating in C but I do not believe it can be done like how you want it to.