[Title] to pass a reference set of simple fill in the blank function and pass a value of

#include <iostream>
using namespace std;
 
void fun1(int &x) {
    x++;
}
 
void fun2(int x) {
    x++;
}
 
int main() {
    int abc = 13;
    fun1(abc);
    printf("%d\n", abc);
    fun2(abc);
    printf("%d\n", abc);
}

The answer is: 14, 14

Please think about why?

Guess you like

Origin blog.csdn.net/qq_15698613/article/details/94481311
Recommended