TC Compiler behaving unintended

go4expert's Avatar, Join Date: Aug 2004
Team Leader
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's Avatar
Ambitious contributor
hain ,
that the internal working of compiler how to treat the %d in scanf.