Reference Parameter Update

#include <iostream>

void update(int &Rx, int d){
    Rx += d;  
}

int main() {
    int32_t x, delta;
    std::cin >> x >> delta;

    update(x, delta);

    std::cout << x;   // Print updated value

    return 0;
}

Syntaxing

 

 

 

 

Upvote
Downvote
Loading...

Input

10 4

Expected Output

14