K
knight
I tried to convert a string to long integer using the following code
but it is not working. I tried with strtolI and strtod. I think the
input exceeds long integer range. What function shall i use in c to
accomplish this ? Please help me.
void main()
{
char a[20]="4051592851";
long int i;
double d;
i = strtoll(a,NULL,10);
printf("%ld\n",i);
d = strtod(a,NULL,10);
printf("%lf\n",d);
}
O/p
-243374445
-765460480.000000
but it is not working. I tried with strtolI and strtod. I think the
input exceeds long integer range. What function shall i use in c to
accomplish this ? Please help me.
void main()
{
char a[20]="4051592851";
long int i;
double d;
i = strtoll(a,NULL,10);
printf("%ld\n",i);
d = strtod(a,NULL,10);
printf("%lf\n",d);
}
O/p
-243374445
-765460480.000000