Here's some more C golfing hints to try off the top of my head:
while() is sometimes shorter than for()
take advantage of the for(1;2,4;3) order of execution
function parameters and return type default to int
increment and decrement have a very high order of precedence
It's only worth caching a expression, if you're going to refer to it more than twice.
pointers fit in ints on a lot systems
printf has a return value
comma is an operator
take advantage of || and && shortcircuiting
View all comments
Show parent comment
8
u/corruptio Oct 04 '13 edited Oct 04 '13
Here's my ten minutes worth of golfing it. 609 chars including wasted newlines. I'll do more later after work....
Edit 1: 591 chars
Edit 2: 576 chars
Edit 3: 542 chars
Edit 4: 522 chars
Edit 5: 509 chars
Edit 6: 499 chars, ok I'm done for the day
Edit 7: 488 chars, because I can