+ 3
What does this mean?
int &y = x;
2 Respuestas
+ 9
It declares and initializes a reference (alias) called `y` for `x`. In other words, `y` holds the same value as `x` and altering `y` affects `x`, as well.
#include <iostream>
int main() {
int x = 10;
int &y = x;
++y;
std::cout << x; // 11
}
_____
https://en.cppreference.com/w/cpp/language/reference
https://en.cppreference.com/w/cpp/language/reference_initialization
+ 3
Thanq..