passing *char parameters by reference

Gary Schaps gls at novavax.UUCP
Thu Aug 10 06:20:23 AEST 1989


Would someone be kind enough to tell me why this program fails?

char *x, *y;
{
   register char *temp;

   temp = x;
   x = y;
   y = temp;
}

main()
{
   char *a="aaaa";
   char *b="bbbb";

   swap( &a, &b );
   printf( " a = %s\t b = %s\n", a, b);
}



More information about the Comp.lang.c mailing list