Friday, January 29, 2010

Optimizing the Code of Wen Fang Chen's Blog

Her code can not calculation for negative number. I fixed it.

void sep(int val){
int i;
if (val<0){
val=-val;
bio_putch(45);
}

if(val/10){
i=val%10;
sep(val/10);
}
else
i=val % 10;
bio_putch(i?i+48;48);
}

void bio_putch(int val){
sep(int val);
}

2 comments:

  1. I don't see a link to Wen Fang's blog, so how do I know what you fixed?

    Also, your default language for your blog is Chinese. I had to guess that what I am clicking on is comment. Please correct this.

    ReplyDelete
  2. Sorry, Iam forgot to set Language to English.
    And Wen Fang's blog link is here

    ReplyDelete