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);
do{len<0?io_putstr(str):io_putch(*str?*str++:'\0');}while(--len>0);
}

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

Monday, September 14, 2009

First Blog Evar!

After a trailing 10 mins. I set up my Blog account, Now onto the feeds.