Can anyone pls clarify this code? : I have a doubt in the very basics of C . 

 - I have written the following code.Here in the function add(), i m not returning anything and so I expected that the output will be some junk value or something, but it didn't happen like that.Can anyone explain me why was it happening like that.? Please excuse me if I have written something wrong in the code.To my understanding, 
 - I thought the memory for ***variable*** ***add1*** will be from stack and hence once the **add ()** is done , all the memory allocated will be freed and hence some junk value will be displayed.

Code sample
=======

main()
{

int x=4,sum;

int n;

printf(" enter a number \n");
scanf("%d",&n);

sum = add(x,n);

printf(" total sum = %d\n",sum);

}


add(int x,int n)
{

int add1=0;

add1 = x+n;

//return(add1);
}

