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.
我不是在寻找 C 中的函数,宏会有所帮助。这就是我想使用位图的方式。用法 :
int bitmap; if(bitmap != 0) do something else do something
假设位图变成了位图数组,我如何获得相同的结果(不进行函数调用)?
您可以遍历数组:
int i; int non_zero_found = 0; for (i = 0; i < sizeofthearray; ++i) { if (array[i] != 0) { non_zero_found= 1; break; } } if (non_zero_found) { // do something }