struct node {
int data;
struct node **next;
};
can we use like this???
You can, but my immediate question is why do you want to do so? There has to be a purpose for any level of indirection, otherwise it's just pointless complexity.
I think it is stupid thing to use pointer to pointer in this case.
Why do you need a two level pointer? Isn't a single level enought?
without the string reason, try to avoid double pointers in C. It will make your code complex and will confuse you at this stage of learning ;)
Pointer to pointer is not necessary here as I understand.The concept of pointer to pointer comes into use when you pass a multidimensional array into a function or pass a pointer by reference to a function where you wish to change its value.For excample you want to create a linked list but its head and end pointers have to be declared in main.The you set up a function that will take head and end as arguments to accomplish the purpose.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.