Question: Based on your knowledge of pointers and memory addresses, answer the questions following the code snippet below: # include int hcf ( int *x, int
Based on your knowledge of pointers and memory addresses, answer the questions following the code snippet below:
# include
int hcf ( int *x, int *y) { *x = *y;
int a = *x; int b = *y;
while (b != 0 ) { int tmp = b; b = a % b; a = tmp; } return a; } int main () { int a = 54 ; int b = 24 ;
int result = hcf(&a, &b);
return 0 ; }
Part a What will be the value of the result variable after calling hcf function?
Part b What will be the value of the variables a and b just before the program terminates?
Part c Briefly explain (in 1 or 2 sentences) your answers to part a and part b of this question.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
