Hello, I have a problem using dinamic allocation for numberic types. That's what I'm doing
The printf showsCode://IDE = DevC++ //compiler = MingW //compiled as cpp #include <conio.h> #include <stdio.h> #include <stdlib.h> typedef struct _DATA { double *dbl; } DATA,*LPDATA; int main() { double dbl; DATA d; d.dbl=(double*)malloc(sizeof(*d.dbl)); if(!d.dbl) {return 0;} dbl=125.15f; *d.dbl=dbl; printf("%f %f\n",dbl,d.dbl); free(d.dbl); getch(); return 0; }
My question is, ¿how should I setup a dynamic double value and be able to work with it? Maybe I'm missing something, but I have been thinking about it but I'm no able to find a working solution.Code:125.150002 0.000000
Thank's in advance
Niara