Swap two values · 2つの値を交換する
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · このページには最新のブラウザ(SharedArrayBuffer対応)が必要です。Chrome、Edge、Firefox、Safariを最新バージョンに更新してください。
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.
日本語
2つの値を交換する
swap は2つの整数へのポインタを受け取り、それらの値を交換する必要があります。ポインタを通じて、*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 が指す2つの整数を交換します。ポインタを使用してください — *a は a の位置にある値です。
Click Run to see the output here. · 実行ボタンをクリックして出力を確認してください。