Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我看到了这行代码:
fputc("01234"[(int)tmp_seq[j][i]], opt->fp_bfast);
直到现在我还想fputc得到一个字符并将其放入输出流中。这行代码是做什么的
fputc
"01234"该代码通过将字符串视为字符数组来索引字符串以选择字符。指数为(int)tmp_seq[j][i]。
"01234"
(int)tmp_seq[j][i]
大概(int)tmp_seq[j][i]持有一个介于0和4包含之间的值,否则会出现数组索引越界错误。
0
4
"01234"[(int)tmp_seq[j][i]]是一种相当可怕,低效的写作方式'0'+tmp_seq[i][j]......
"01234"[(int)tmp_seq[j][i]]
'0'+tmp_seq[i][j]