Question: C language using the skeleton code provided below: Write a program with the following: The function int foo(int* a, int *b, int c) should perform

C language using the skeleton code provided below:

Write a program with the following: The function int foo(int* a, int *b, int c) should perform the following computations -- 1) Increment a. 2) Decrement b. 3) Assign a + b to c. 4) Return the value of c. In the main function, declare three integers x, y, and z, and assign them random integer values in the interval [0, 10]. You should use the C math library random number generator rand() to generate random numbers. Make sure that your use of rand() correctly generates nonnegative integers x, y, and z that are less than 11. Print the values of x, y, and z. Call foo() appropriately passing x, y, and z as arguments. Print out the values of x, y, and z after calling the function foo(). Also, print the value returned by foo().

skeleton:

#include #include

int foo(int* a, int* b, int c){ /* Increment a */ /* Decrement b */ /* Assign a+b to c */ /* Return c */ }

int main(){ /* Declare three integers x,y and z and initialize them randomly to values in [0,10] */ /* Print the values of x, y and z */ /* Call foo() appropriately, passing x,y,z as parameters */ /* Print the values of x, y and z */ /* Print the value returned by foo */ return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!