面试问题,盼答案

来源: 2010-08-25 14:36:59 [旧帖] [给我悄悄话] 本文已被阅读:

1) Why is this program not portable:

#include
#include

/* This function returns a value in which bit 'n' is set. Bits are
counted from right to left. The rightmost bit (the least significant
bit) is bit #0. */
long
set_bit(unsigned n)
{
assert(n
return 1 }




2) A flex input file contains this regular expression that is supposed
to match a C comment. Is it correct? If not, why not.

"/*""/"*([^*/]|[^*]"/"|"*"[^/])*"*"*"*/"





3) In Perl, what's the difference between "my" and "local"? When should
"local" be used?