#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); }
exchange two values via references