Values & References4 / 16
Up next

std::swap

#include <print>
#include <utility>

int main() {
    int a = 1;
    int b = 2;
    // swap works through references, no temporary of yours needed
    std::swap(a, b);
    std::println("{} {}", a, b);
}
What you're solving

exchange two values via references