transfernly's Avatar, Join Date: Dec 2009
Go4Expert Member
Quote:
Originally Posted by techgeek.in View Post
why r u getting garbage value?? I did this just check it out...
Code:
# include<stdio.h>
# include<conio.h>
# include<stdlib.h>

void main()
{

char str[]="9960787897z3yu87";
float x;
clrscr();
x=atof(str);
printf("int: %.0f\n",x);
getch();
}




check out the out put is
9960787968
techgeek.in's Avatar, Join Date: Dec 2009
Skilled contributor
Code:
 # include<stdio.h>
# include<conio.h>
# include<stdlib.h>

void main()
{

char str[]="9960787897z3yu87";
double x;
clrscr();
x=(double)atof(str);
printf("int: %.0lf\n",x);
getch();
}
sorry..now i have modified it and itz working
output is:-9960787897