Because he...
Suppose you use unsigned characters (the same goes for large integers).
If L is 100 and R is 200, the first version:
M = (100 + 200) / 2 = 300 / 2 = 22
100 + 200 overflows (because the largest unsigned char is 255), and you get 100 + 200 = 44 (unsigned addition).
Second, on the other hand:
M = 100 + (200-100) / 2 = 100 + 100 / 2 = 150
No overflow.
As @ user2357112 noted in the comment, there are no free dinners. If L is negative, the second version may not work while the first is.
source share