When a variable is not initialized in main function it contains garbage value. This can be well seen from the example below
main()
{
int x;
printf(“%d”,x);
z= sample()
}sample()
{
printf(“Testing program”);
}
Output is
x=80
Testing program
The above program prints a garbage value and the output testing program. This is because the variable x is not initialized and so the variable x had garbage value which is printed first then the function sample is called which gave output as testing program. Thus it is essential to initialize variables in main () function.