Skip to content · ⁨コンテンツへスキップ⁩

Swap two values · ⁨2つの値を交換する⁩

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 は指す値を読み取ったり書き換えたりできます。もう一方の値をコピーする際に片方を失わないよう、一時的な変数を使用してください。

Log in or create account · ⁨ログインまたはアカウント作成⁩

IGCSE, A-Level & AP