Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How can we swap the values of 2 integer variables without using temp variable?

user-image
Question ajoutée par ibrahim mohsen , Project Manager , Integrant Egypt
Date de publication: 2014/05/22
عبد الرحمن أحمد عبد المنعم أحمد
par عبد الرحمن أحمد عبد المنعم أحمد , Army Engineer , Egyptian Armed Forces

//swapping x and y

x = x + y;

y = x - y;

x = x - y;

Nanak Singh Saggu
par Nanak Singh Saggu , Vice President - PROJECTS , SAGGU ENGINEERS

Using the XOR swap algorithm

ibrahim mohsen
par ibrahim mohsen , Project Manager , Integrant Egypt

Good, any other solution? :D

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?