Afficher un message
Vieux 13/04/2008, 18h56   #2
Morris Dovey
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem with atoi and strlod

Sanchit wrote:
>
> #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.


try %f

--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USA
http://www.iedu.com/DeSoto/
  Réponse avec citation
 
Page generated in 0,06796 seconds with 9 queries