Consider the following code. double foo(int count, double base) { return count *
ID: 3645752 • Letter: C
Question
Consider the following code.double foo(int count, double base)
{
return count * base;
}
int main (void)
{
int n = 5;
double y = 1.1;
double x = foo(n, y);
// Statements to do more work, etc.
}
a. The call to foo copies the value of n to count, copies the value of y to base, and returns the product of count and base.
b. It will not compile because of there is no function prototype provided.
c. It will compile, but will not work correctly since y is passed by value.
d. The variable n is passed by value and is protected, but the variable y is passed by reference and is not protected.
Explanation / Answer
It will compile, but will not work correctly since y is passed by value. d
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.