In the insert version you are passing
head
as parameter using the same name as your global variable. Because it is a function, the local (parameter) variable is used and the content of the global variable is left unchanged.
In the second version the global variable is used and modified.
To get similar behaviour assign the return value of the
insert
function to your global variable:
head = insert_(head,4);
[EDIT]
And of course the error reported in solution 1 which I did not saw because the code was initially not formatted.
[/EDIT]