title: Why does this practice code fail when length == 0?
body: <p>Hi I have this book with a practice question which I am unable to answer. And no...this is not a homework question. This is my self study from a book recommended to me called: "Computer systems, A programmer's perspective"</p>
  
  <p>Here is the question:
  <img src="https://i.stack.imgur.com/UGgZN.png" alt="enter image description here"></p>
  
  <p>Any help is appreciated!</p>