+ 1
For the Code Below Please someone explain How the value of variable 'number' bcame 64 when we print it for the second time?
#include <iostream> using namespace std; void square(int&ptr){ ptr=ptr * ptr; } int main() { int number=8; cout<<number<<endl; square(number); cout<<number; return 0; any help is appreciated..thank you }
1 ответ
+ 2
The & in the square function says that modifications on ptr are also done on number.