What will be printed out as a result of the following program's execution?
#include <iostream>

void qwer(int &param) {
  param += 15;
}

int main(void) {
  int a = 14;
  void (*realFunction)(int &) = &qwer;  
  realFunction(a);
  std::cout << a;
  return 0;
}
Explanation
In pass by reference (also called pass by address), a copy of the address of the actual parameter is stored. Use pass by reference when you are changing the parameter passed in by the client program.
Source: Function pass by value vs. pass by reference

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты