i have two questions right now in my mind :
question - 1 :
please have a look at this code :
void function (int recd)
{
printf ("%d", recd);
}
void main()
{
int p=10;
function(p);
}
here...when p is passed to function, the thing that actually takes place is :
a new variable recd is created and value of p is copied to recd (i mean a copy of p is created...consuming another 2 bytes)...
now please check the following code :
void function (int *recd)
{
printf ("%d", *recd);
}
void main()
{
int *p;
*p=10;
function(p);
}
does the same thing happen here?? i mean here too.. new pointer variable recd is created and value (an address) stored in pointer p is copied to recd???
void function (int *recd)
{
printf ("%d", *recd);
}
void main()
{
int p=10;
function(&p);
}
and here too, does the same thing happens???
please throw some light on it... :)
question - 2:
void main()
{
int **p;
**p = 10;
}
in the above code, where the hell is 10 stored???
what exactly happen in above code??
my guess is : its stored in *p...
i mean **p has a garbage which is taken as *p...and *p has a garbage which is taken as the address of 10....is this right or a garbage?? :P :)