can any one tell me how to write prog to swap two var without usingthe third var.
Printable View
can any one tell me how to write prog to swap two var without usingthe third var.
:(
This was discussed about 2 weeks ago...do a search please
>can any one tell me how to write prog to swap two var without usingthe third var.
There's no reasonable point to using this technique, but for integral values only you can use binary XOR:
-PreludeCode:void swap ( int *a, int *b )
{
*a ^= *b;
*b ^= *a;
*a ^= *b;
}