The culprit in this program is printing a float variable with %d specifier.
printf("%d\n", t);
Removing this line, the program behaves normally.
This line may crash your program. Also it may remove some bytes from your
stack.
I feel this is what happening.
Even I am not very convinced. Still trying to find out !!!
On Fri, Aug 5, 2011 at 9:57 PM, snehi jain <[email protected]> wrote:
> #include<stdio.h>
> main()
> {
> long x;
> float t;
> scanf("%f",&t);
> printf("%d\n",t);
> x=90;
> printf("%f\n",x);
> {
> x=1;
> printf("%f\n",x);
> {
> x=30;
> printf("%f\n",x);
> }
> printf("%f\n",x);
> }
> x==9;
> printf("%f\n",x);
> getch();
> }
>
>
> o/p
> (when i had given input as 67 this is the output)
>
> 0
> 67.00000
> 67.00000
> 67.00000
> 67.00000
> 67.00000
>
> can anyone explain me he output..
>
> Thanks
> Snehi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
Mithun.B.S
M:9916775380
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.