CCoding Style - Break up complex expressions

From EdWiki

Break-up complex expressions

  • C has a very rich expression syntax and operators, and it’s easy to get carried away by cramming everything into one construction.
  • An expression like the following is compact but it packs too many operations into a single statement:
*x += (*xp = (2*k < (n-m) ? c[k+1] : d[k--]) );

It’s easier to grasp when broken into several pieces:

if( 2*k < (n – m) )
    *xp = c[k+1];
    *xp = d[k-1];
*x += *xp;