How can be the macro below modified to handle non-scalar types as well like
struct test {int mint,char [16+1]}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/* a macro swap(t,x,y) that interchanges two arguments of type t */
#include<stdio.h>
#define swap(t,x,y) { t _z; \
_z = x;\
x = y;\
y = _z; }
int main(void)
{
char x,y;
x='a';
y='b';
printf("x= %c \t y= %c\n",x,y);
swap(char,x,y);
printf("x=%c \t y=%c\n",x,y);
}
Not really.But it can be that I am doing a mistake in main.Could you please provide me with main als well so I can search for a mistake in my code,if possible.And is there a difference between char s[16+1] and char s[17]?