Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C ++ could you leave comments for the funtions. thankyou Problem 1. In the main function, declare an integer variable x and set its value
C
++ could you leave comments for the funtions. thankyou
Problem 1. In the main function, declare an integer variable x and set its value equal to 5 . Write a function called F, which takes the argument x as a reference and changes the value of the variable x in the main function by adding 20 to it. Note, the function F does not return a new variable - instead it changes the variable x in the main function via its address. Problem 2. In the main function, declare an integer array A with value 1,3,5,7,9. Write a function called G, which takes the address (recall the connection between arrays and pointers) of the array A and its size (as integer variable n ) as its arguments and changes each value in the array A in the main function by adding to it its integer index location. Note, the function G does not return a new array - instead it changes the array A in the main function via its address. Print the new array values in the main function. Problem 3 . In the main function, declare integer variables x,y, and z, whose values are set randomly - for example x=7,y=9,z=3. Write a function called H, which takes thee variables x,y, and z as reference arguments. The function H then returns the the smallest of the three values. Make sure that your function can return the correct result even if the variable values are different, for example, x=1,y=3,z=3 or x=4,y=2,z=5. Note, the function H has a return statement - unlike in the first two problems
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