I (newbie) have a question on pointers. I'll paste the code. I know how the main sends to the call, but after that I'm lost. Can anyone explain what happens? The program runs and the execution is: "In hi and d = 16"; "In hi again and d = 23"; "In Main and a=8, b=15, c=5". So I know the answers but no clue how it works
Code:
#include <stdio.h>
void ho(int *k, int l, int *m);
void hi(int *x, int *y, int d);
int main(void)
{ int a,b,c;
c=5;
hi(&a, &b, c);
printf("In main and a=%d, b=%d, c=%d",a,b,c);
return (0);
}
void ho(int *k, int l, int *m)
{ *k = 5 * l;
*m = l + 20;
}
void hi(int *x, int *y, int d)
{ int a;
a=3;
*x = 8;
d = *x + d + a;
printf("In hi and d = %d\n", d);
ho(y, a, &d);
printf("In hi again and d = %d\n", d);
}