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. · اضغط تشغيل لرؤية المخرجات هنا.