What is the difference between struct node *tmp and struct node **tmp in data structures? If possible show with example. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 32

What is the difference between struct node *tmp and struct node **tmp in data structures? If possible show with example.

24th Feb 2018, 10:17 AM
𝘕𝘉
𝘕𝘉 - avatar
2 Answers
+ 4
One is a pointer to a struct, the other is a pointer to a pointer. The first let's you pass it to a function and allow the function to modify the contents of the original object. The second allows you to do that or to assign a new struct to the variable that will then be passed back out of the function.
25th Feb 2018, 4:32 PM
Jesse Bayliss
Jesse Bayliss - avatar
+ 15
Ok.
26th Feb 2018, 2:03 PM
𝘕𝘉
𝘕𝘉 - avatar