Hello guys,
i'm new in C..
i have code like this :
#include <stdio.h>
#include <stdlib.h>
char *inputstr;
double atofret;
void main() {
inputstr="1234567890.1234";
atofret=atof(inputstr);
printf(" Converted to : %14.4f \n",atofret);
}
the result when i run the program is :
Converted to : 12345678901234.1230
The question is ?
why the string input and the atof output aren't same 1234567890.1234 ?
and if there any way to make it same input and output.. can somebody tell me ?
Thank you.
regards,
Ekow
i'm new in C..
i have code like this :
#include <stdio.h>
#include <stdlib.h>
char *inputstr;
double atofret;
void main() {
inputstr="1234567890.1234";
atofret=atof(inputstr);
printf(" Converted to : %14.4f \n",atofret);
}
the result when i run the program is :
Converted to : 12345678901234.1230
The question is ?
why the string input and the atof output aren't same 1234567890.1234 ?
and if there any way to make it same input and output.. can somebody tell me ?
Thank you.
regards,
Ekow