I have a really basic question regarding how memory gets allocated in a code written in C.
Let's say that I have something like this:
int pointless(int a);
int main(){
int num1,num2;
num1=1;
num2=pointless(num1);
return 0;
}
int pointless(int a)
{
return a;
}
What I would like to know is what is happening inside the pointless() function. In main() we have already allocated two bytes for the "num1" variable, which gets passed on to the called function. At this point, when I jump into the pointless function, will it allocate the space once more - now for the "a" variable - or will it simply somehow only allow the function to access the value of the variable in the memory? (I am going to get problems with what I am writing now if temporarily there's a duplicate allocation for the variables while we're inside the pointless() function.)
Thanks!