Azienda coinvolta
How do you swap variables without using a temporary variable? Assume the variables are always integers.
Anonimo
Shouldn't the last line be b = b - a;
// Example, a = 4, b = 3; void swap (int a, int b) { b = a + b; // b = 7 a = b - a; // a = 3 b = b - b; // b = 4 }
Non lasciarti sfuggire opportunità e informazioni privilegiate seguendo le aziende dove vorresti lavorare.
Ricevi suggerimenti e aggiornamenti personalizzati avviando le tue ricerche.