When I want to change int in function I pass pointer to int so int will change
I am trying to understand how we change the structure in function
What we pass address of structure or value of structure to change structure ?
Code:
#include<stdio.h>
void foo ( int *ptr )
{
*ptr = 10;
}
int main ()
{
int a = 1;
foo (&a);
printf("%d", a);
return 0;
}
I am trying to understand how we change the structure in function
Code:
int main ()
{
struct node * P = NULL;
foo (&P);
foo (P);
return 0;
}
What we pass address of structure or value of structure to change structure ?