Question: Hi I am solving this c-programming question, but I am stuck. Can anyone help me with this question? b) Given the C function shown in
Hi I am solving this c-programming question, but I am stuck. Can anyone help me with this question?


b) Given the C function shown in Figure 1 , answer the following questions: i. What is its intended functionality? ii. For which valid values of min and max does the function work as intended? iii. What are the major issues of this function? iv. Write a re-implementation of the function that fixes the major issues present in the function. Comment your code accordingly, explaining how your solution solves the problems. \begin{tabular}{|lll|} \hline 1 & int GetRandomnumber (int min, int max) \\ 2 & \{ & \\ 3 & int number; \\ 4 & do \\ 5 & \{ \\ 6 & number = random (); \\ 7 & \}while ( (number( number >max)); \\ 8 & return number; \\ 9 & \} & \\ \hline \end{tabular}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
