Hi everyone.

In this post I'm gonna show you just the definition of a function that I can't understand.

Here we have the exercise.....
Given a binary search tree:
define a recursive function which makes a simmetric visit of the tree and which prints the value of every node.


Two notes:
Note number one: simmetric visit is that kind of visit which shows in order:
1) Left sons;
2) Root;
3) Right sons.
Note number two: every node of the tree is made like this:
Code:
        struct btree{ 
              float value; 
             struct btree * left_ptr; 
             struct btree * right_ptr; 
             }


Here we have the definition of the function that I can't understand:

Code:
void visit_r(struct btree * ptr){ 
/*function which takes in input a pointer to struct btree*/



if (ptr != NULL) { /*if the pointer points to something*/

    printf("I search the left son... "); 

    visit_r(ptr->left_ptr); 
/*I can't understand what happens here. I re-use my 
function with a new input, but I will give a new input 
until pointer==NULL. 
When pointer will be == NULL, I will not
 enter in the "if cycle", and I will not be able
 to print the value of my nodes!*/


    printf("\n I print the value: %f \n", ptr->value);


printf("I search the right son... "); 
visit_r(ptr->right_ptr);
} printf("Let's go back... "); 

/*I can't understand neither how it can go back, 
how it can 'climb' the tree*/
}
Thanks everyone!!