Macros are pre-processed before compilation and you can virtually write anything in macros that would be replaced. In function arguments, you can not pass data types as arguments.
Side note:
#define SWAP(a,b,c) do { c t;t=a;a=b;b=t; } while(0)
is a safer macro implementation than the one mentioned by you. Moreover name t is quite common. If either of the argument name is t, this won't work as expected, so better choose some rare name. Capital letters are usually preferred in macro definition.
for ex: #define SWAP(a,b,c) do { c MACRO_TEMP_;MACRO_TEMP_=a;a=b;b=MACRO_TEMP_; } while(0)
SWAP(x,y,int);
Becomes c t;t=a;a=b;b=t;
where all occurances of c are replaced with int, a with x and b with y. Resulting in: ìnt t; t = x; x = y; y = t;
To understand the macros better, you can see the pre-processed output of your code. Output on my computer:
$ cat q26727935.c
#define SWAP(a,b,c) c t;t=a;a=b;b=t;
int main() {
int x=10,y=20;
SWAP(x,y,int);
}
$ gcc -E q26727935.c
# 1 "q26727935.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "q26727935.c"
int main() {
int x=10,y=20;
int t;t=x;x=y;y=t;;
}
$
Macro is replacement at pre-processor stage, so swap will work even with pointers, although this is superfluous.
In function you can not pass data type as arguments, so it won't work.