:icon_smile:
hi all!!
i am a newbie in this forum.
can u solve me the problem of interchanging/swapping the value of two varibles without using the third variable...
thanks..
argonaut
0
Newbie Poster
Recommended Answers
Jump to Posthttp://www.catb.org/~esr/faqs/smart-questions.html#writewell
Yes you can http://c-faq.com/expr/xorswapexpr.html
But that is a dumb trick which ceased to be …
Jump to PostHere's anothe way
x -= y; y += x; // y becomes x x = (y - x); // x becomes y
All 7 Replies
Salem
5,138
Posting Sage
GreenDay2001
Salem
5,138
Posting Sage
Narue
5,707
Bad Cop
Team Colleague
ssharish2005
62
Posting Whiz in Training
alsoumhi
0
Junior Poster in Training
Salem
5,138
Posting Sage
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.