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