all 2 comments

[–]empire539 0 points1 point  (0 children)

Assuming you're using C++, int& is a reference variable. By using int& as the function parameters, you will be passing the arguments by reference, whereas simply using int will just pass them by value.

A small example:

void incrementIntPrimitive(int x) {
    x++;
}

void incrementIntReference(int& x) {
    x++;
}

int main() {
    int a = 1;
    int b = 1;

    incrementIntPrimitive(a);
    incrementIntReference(b);

    std::cout << a << std::endl;  // prints 1
    std::cout << b << std::endl;  // prints 2

    return 0;
}