Swap two values · Tukar dua nilai
Swap two values
swap receives pointers to two integers and must exchange their values. Through a pointer, *a reads — or writes — the value it points at. Use a temporary variable so you don't lose one value while copying the other.
Tukar dua nilai
swap menerima pointer ke dua bilangan bulat dan harus menukar nilainya. Melalui pointer, *a membaca — atau menulis — nilai yang ditunjuknya. Gunakan variabel sementara agar Anda tidak kehilangan satu nilai saat menyalin yang lain.
Complete void swap(int *a, int *b) to exchange the two integers that a and b point to. Use the pointers — *a is the value at a. · Selesaikan void swap(int *a, int *b) untuk menukar dua integer yang ditunjuk oleh a dan b. Gunakan penunjuk — *a ialah nilai pada a.
Click Run to see the output here. · Klik Jalankan untuk melihat output di sini.