Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   TC Compiler behaving unintended (http://www.go4expert.com/forums/tc-compiler-behaving-unintended-t108/)

go4expert 9Aug2004 17:20

TC Compiler behaving unintended
 
Hello All

There are 2 code snippets
Code:

main()
{
int a=3;
printf("%d \t%d\t %d",a);
}

TC Output 3 3 0
GCC Output 3 0 garbage
Code:

main()
{
long int a=3;
printf("%d \n%d\n %d",a);
}

Output 3 0 3
GCC Output 3 0 garbage

can anyone explain why this unintended behaviour if both the compilers.

alok 9Aug2004 17:39

Re: TC Compiler behaving unintended
 
hain ,
that the internal working of compiler how to treat the %d in scanf.


All times are GMT +5.5. The time now is 23:44.