Hi! Its a good question. I am new to c and I think in your main function where f = d you are shifting value of d to f but in reality its not happening. Look *f points to value of c1 so it should be something like this:
Code:
#include<stdio.h>
#include<stdlib.h>
void dereference(int* a, int* b);
int main(int argc, char **argv)
{
int c = 4;
int c1 = 3;
int* d = &c;
int* f = &c1;
dereference(f,d);
printf("b: %d\n",(*f)); // b = 3
c = c1;
// f=d;
printf("b: %d\n",(*f)); // b=4
return 0;
}
void dereference(int* a, int* b)
{
a=b;
}
I am sorry since I am new to the programming but I think it should happen. Please share if you think I am wrong.