I have the followin code of C :
float *dv(int a, int b);
int main() {
int x ,y;
scanf("%d%d",&x,&y);
float *pt;
pt = dv(x,y);
printf("The div is %f", pt);
return 0;
}
float *dv(int a, int b){
float d;
d = (float) a / b;
return &d;
}
and I have some questions about it! If I skip the pointer declaration/initialization
pt = dv(x,y);
and I write into printf("The div is %f", *dv(x,y));
it plays normally! But WHY? Where is my mistake??