in reply to Golf: string complement

It seems as if your C code has a bug. You allocate an array of limit == 255 elements for table array. These elements would be indexed from 0 to 254. But you set
table[limit] = 0;
which stomps on the memory location just after the end of the array. The bug would be fixed by mallocing an extra element:
char *table = (char *) malloc( (limit + 1) * sizeof(char) );
Happily, Perl does not have these sorts of problems.

-Mark

Replies are listed 'Best First'.
Re: Re: Golf: string complement
by japhy (Canon) on May 15, 2004 at 16:08 UTC
    Oh. Oops. Thanks.
    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;