Which line is responsible for data being transferred from the function getArea back to main?
int getMomentum(int mass, int velocity); //Line 1
int main()
{
int momentum = getMomentum(3, 5); //Line 2
return 0;
}
int getMomentum(int mass, int velocity) //Line 3
{
return mass * velocity; //Line 4
}
Answer:
Reason: in the given code at line number there is return statement which takes the whole responsibilty of function to transfer its generated value to the main function. So that at main function we can call the function and access the return value which is sent by the function.
------------------------------------------------------------------------------------
Hope this helps you if you still have any doubts or queries please comment in the comment section.Thank you. Do upvote.
Get Answers For Free
Most questions answered within 1 hours.