Need help with the following code....
Code:
#include<stdio.h>
int calsum(int x,int y,int z);
void main()
{
int a,b,c,sum;
printf("\nENter any three numbers\n");
scanf("%d\n%d\n%d",&a,&b,&c) ;
sum=calsum(a,b,c);
printf("\nSum=%d\n",sum);
}
int calsum(int x,int y,int z)
{
int d;
d=x+y+z;
return;
}
I thought this program will print garbage value...
but in a compiler C-free : it outputs the value x+y each time and in gcc compiler it gives the value of x+y+z
Can you explain the actual behaviour of the program please.