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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started