← Back to Gists

swap two integers

📝 C
moniquediaz119
moniquediaz119 · Level 10 ·

This snippet efficiently swaps two integers by using a temporary variable.

C
void swap(int a, int b) { int temp = a; a = b; b = temp;
}

Comments

No comments yet. Start the discussion.