Swap two values · החלפת שני ערכים
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.
החלפת שני ערכים
swap מקבל מצביעים לשני שלמים וחייב להחליף את ערכיהם. באמצעות מצביע, *a קורא — או כותב — את הערך אליו הוא מצביע. השתמש במשתנה זמני כדי לא לאבד ערך אחד בזמן העתקת השני.
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. · השלם את void swap(int *a, int *b) כדי להחליף בין שני השלמים אליהם מצביעים a ו b. השתמש במציינים — *a הוא הערך ב a.
Click Run to see the output here. · לחץ על הרץ כדי לראות את התוצא כאן.