But what about this check at the start:
Code: Select all
if( values == NULL )
error return .....
2) the check has absolutely nothing whatsoever to do with the real purpose of the function - the averaging algorithm.
If I were to write instead:-
Code: Select all
if( values != NULL )
{
function body
}
That makes it less readable I think.
The nesting level should reflect the real code logic only.
Yes, yes I know "assert( values != NULL );" would be better, but just to illustrate the point.