int z; // we are declaring variable name z is name of variable //
int z=10; // we are declaring variable and assigning value 10 to variable z
&z means the address of variable z
int *a // we are declaring pointer variable and name of pointer variable is a and * is operator //
int *a = 15 // we are declaring and assigning value 15 to pointer variable a //
int *a = &Z means we are assigning address of variable z to pointer variable a
Code:
#include<stdio.h>
void function(int a);
int main(void)
{
int z=10;
printf(" Before calling z = %d \n",z);
function(z);
printf("After calling z=%d \n",z);
return 0;
}
void function(int *a)
{
a*=15;
}
actual arguments is z=10; and formal arguments is a* = 15
When program start to execute. it store the value of variable z = 10 then when we call function we pass actual value 10 to function this is known as function call by value, we are passing the copy of actually argument to function
During execution, what does a hold?
I think during execution a will hold the actual value 10