I cannot understand what happens here clearly.
#include  <stdio.h>
#include  <stdlib.h>
#include  <unistd.h>
int *f(int x){
    int p;
    p=x;
    return &p;
}
int *g(int x){
    int y;
    y=x;
    return &y;
}
int main(){
  int *x,*y;
  x=f(1000);
  y=g(250);
  *x = *x + 250;
    printf("%d\n",*y);
    return 0;
}
output:- 500
How come line "*x = *x + 250" change "*y" value? why the output is not 250?
 
    