Skip to content · ⁨דלג לתוכן⁩

Swap two values · ⁨החלפת שני ערכים⁩

English

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 קורא — או כותב — את הערך אליו הוא מצביע. השתמש במשתנה זמני כדי לא לאבד ערך אחד בזמן העתקת השני.

Log in or create account · ⁨היכנס או צור חשבון⁩

IGCSE, A-Level & AP