int add(int x, int y)
{
return x + y;
}
int main()
{
usingnamespace std;
// It is the caller of add() that decides the exact values of x and y
cout << add(4, 5) << endl; // x=4 and y=5 are the parameters
return 0;
}
How does the compiler know to take x and y to be 4, 5 since they are both part or separate functions.
The out-put from this is 9.
it works that out by (x+y) this is all writen in one function; int add (x+y) {}
in int main() {} x and y get the values 4 and 5. How does the compiler know to do this, where is the instruction?