Suri

Suri

  • NA
  • 113
  • 13.3k

Are calls A and B semantically identical? Which is preferable?

Apr 13 2021 6:35 AM
I have a simple question.
  1. #include void inc_mutable(int& x) {++x;  
  2. void inc_pointer (int* x) {++(*x);  
  3. int main() {int x = 10;inc_mutable(x);<- Ainc_pointer(&x);<- Bstd::cout << x;  
  4. }
1) Are calls A and B semantically identical?
2) Which is preferable?

Answers (1)