Whats wrong with my code?

Modified Code

Your mistakes

  1. don’t pass head by reference
  2. in the print function condition is not correct