#include <iostream>
// Function prototype for a function that takes an integer argument by value and increments it
void increment(int x);
int main() {
int num = 5;
// Call the increment function
std::cout << "Before calling the increment function, num = " << num << std::endl;
increment(num);
std::cout << "After calling the increment function, num = " << num << std::endl;
return 0;
}
// Definition of the increment function
void increment(int x) {
x++;
std::cout << "Inside the increment function, x = " << x << std::endl;
}
output :
Before calling the increment function, num = 5
Inside the increment function, x = 6
After calling the increment function, num = 5
0 Comments