The original, historical reason is fear for the ancient, classic bug where you would mix up the = and == operators.
When dinosaurs walked the earth and C was a new language, programmers coming from other languages, most notably Pascal, were particularly prone to write this bug. Because in Pascal, comparison is done by =
rather than ==
.
To avoid that bug, some of the more confused dinosaurs therefore invented this particular coding style. Because if(10 = val)
will not compile. This trick was informally known as the "Yoda conditions", after a Star Wars character who uses backwards, obfuscated language grammar.
Then around 1989, Borland came up with a smart solution to the problem: instead of having programmers make their programs unreadable, let's make a compiler warning for possibly incorrect assignment inside conditions! This was the end of the "Yoda conditions" and every half-decent compiler released since Turbo C has supported a warning for such accidental assignments.
If you encounter someone today, who still thinks this trick is smart, you therefore know that they are either a living dinosaur, or possibly Yoda, the jedi master. In either case you should probably not take any C programming advise from them. But you could ask them why they insist on using a compiler which is worse than Turbo C from 1989.