Q:

Write and test your own version of reset that takes a reference

0

Write and test your own version of reset that takes a reference.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>

void resetInt(int &i) {
  i = 0;
}

int main() {
  int a;
  std::cin >> a;
  std::cout << "before reset: " << a << std::endl;
  resetInt(a);
  std::cout << "after reset:  " << a << std::endl;

  return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now