|
Re: Write a program that swaps two integers without using = sigh
Hope this answers...(C based solution)
void swap( int &r,int &s )
{
if( r < s )
{
--s;
swap( r,s );
++r;
}
else
if( r > s )
{
--r;
swap( r,s );
++s;
}
}
__________________
Give 1 cup rice to a hungry Indian just by a mouse click. No money, no form filling, no hassle... Click here for the donation.
|