Quote:
Code:
if( arg < 10 ) {
    arg = test( arg + 1 );
  }

Do you guys ever omit the brackets?:
Code:
if (arg < 10)
	arg = test(arg + 1);

...is how I will do it whenever there's only one line in the "if". I like it clean and minimalist. I know I could go further and have "if (arg < 10) arg = test(arg + 1);" in one line, but I like going down a line and indenting because it means there's always an indented line after my "if"s, whether they're one-liners or not.

Also, I like a space between the "if", "else", or "while" and the opening parenthesis, but no space between parentheses and arguments. I would do Joozey's example like this:
Code:
void test(int arg) {
	displayNumber(arg, 14, 23);

	if (arg < 10)
		arg = test(arg + 1);
	else if (arg == -1 ||
		arg == -3 ||
		arg == -5)
		return -1;
	else
		return 0;
}


I wish Lite-C supported ternary expressions. I quite like "x = x < 0 ? -x : x;" for finding the absolute value, for example (though since there's a built in function, I'd use "abs" anyway, but that's just an example).

Jibb


Formerly known as JulzMighty.
I made KarBOOM!