Task
In this challenge, you had to create a function that returns the result of another function.
Solution
A skeleton of the function was already provided for you. Let’s look it over.
num arithmeticCalculator(Function f, int x, int y){
}
The function name is arithmeticCalculator
and it has three parameters. The first parameter is another function, f
. The second parameter is an integer, x
, and the third parameter is an integer, y
.
You had to write a line of code that would print the result of f
given that it was passed x
and y
as arguments.
f(x,y)
You can find the complete solution below:
You were required to write the code given on line 2.
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy