0
Reference with fonction
When i do: void incre(int &var); int main() { int var = 20; incre(var); cout<<var<<endl; return 0; } void incre(int &var) { var++; } Why does it work ? My fonction need a reference and i havent
5 ответов
+ 3
you have a reference variable which is another name to the same address on RAM
+ 1
no
0
?? it does work.
edit.. sorry mis-read....thought you ment 'why it doesn't work'.
0
It works. Why ?
0
I dont need To do ? :
Int var = 20;
Int &rVar = var ;
Incre(rVar);