swap (char *p, char *q)
{
printf ("%c\t%c\n", *p, *q);
*p ^= *q ^= *p ^= *q;
printf ("%c\t%c\n", *p, *q);
}
int main (int argc, char *argv[])
{
if (argc < 2)
{
printf ("\nSyntax: ./a.out str\n\n");
exit (1);
}
char *p, *q, temp;
p = q = argv[1];
while (*++q);
q--;
while (p < q) swap (p++, q--);
printf ("%s\n", argv[1]);
return 0;
}
I am facing problem with the EX-OR statement in swap function, where it worked for other types like int, float.
Please any body help me..