scratch

§ Why a Sentinel of -1 Is Sensible

created 2022-05-30
  • See that when we have an array, we usually index it with an array index of 0 <= i < len.
  • If len = 0, then the only "acceptable" i is -1, since it's the greatest integer that is less that len=0.
❦
Newer ৪ Blog ৪ Older