DEV Community

Discussion on: Terrible interview question: Swap variables without a temporary

 
nikodannemiller profile image
Niko Dannemiller

That's a good point. I've assumed that it will just roll over cleanly into negatives or roll down into positive (if both numbers are large negatives) but you're right some compilers in that case.

Thread Thread
 
lazarljubenovic profile image
Lazar Ljubenović

Could be. It's been a reeeeally long time since I've written anything in C or Assembly, so can't speak from the first hand at the moment, unfortunately.

Thread Thread
 
nikodannemiller profile image
Niko Dannemiller

S'all good. I'm still in Uni so outside of little side projects I only really know what professors have brought up. Might ask one about this problem.