Problem with atoi and strlod
#include<stdio.h>
#include<stdlib.h>
int main()
{
double ans;
ans = strtod("25", NULL);
printf("ans = %d\n",ans);
}
OUTPUT :
ans = 0
EXPECTED OUTPUT
ans = 25
Can anyone please explain this... Else tell me an alternative for
converting string to int.
|