Friday, September 18, 2009

OOP344 io_display challenge

As a late night attempt at challenge 2, I decided to have some fun with ternary operators. This is far from efficient code best case you run 2 checks, worst case its 3 checks EVERY run through the cycle. So at the cost of efficiency I played around minimizing the number of readable lines of code.

The source code can be found here.

void io_display(const char *str, int row, int col, int len){
io_move(row, col);

At first I attempted to use string library functions... with mixed success. Eventually I totally abandoned them and opted for this alternative.

No comments:

Post a Comment