why does passing a single pointer to a struct with a struct node* element in it not copy the pointers pointing location by value?

if i have

struct node
{ int data;
  struct node* next;
};

and if i pass a pointer

struct node* ptr;

which is pointing to a memory location of struct type and if i pass this pointer to a function,say
fn(struct node* ptr); and modify the ptr->data part inside the fnt,then why isnt this change reflected when i return from the function…so my basic question is why is it behaving like i passed the data by value although i actually passed it using a pointer…
the issue is resolved if i use a double pointer. but i am curious to know why it doesnt work for a single pointer

Your function calling is right, and data in structures can be changed using functions.
But as you are saying you are having problem, can you share your code using ideone in which you are getting this type of problem…?

I think you can refer this to get your doubt solved.
:slight_smile: