fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. // Code của bạn có liên quan gì đến dịch bit đâu, do hàm change đã thay đổi x rồi đó thôi.
  5.  
  6. int change(int &x) {
  7. x = 0;
  8. x++;
  9. return 1;
  10. }
  11.  
  12. int main() {
  13. int x = 5;
  14.  
  15. cout << change(x) << " " << x << endl;
  16.  
  17. cout << change(x) << " ";
  18. cout << x << endl;
  19. }
Success #stdin #stdout 0s 4396KB
stdin
Standard input is empty
stdout
1 1
1 1