Created
November 10, 2010 11:36
-
-
Save shihongzhi/670735 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define BITNUMBER 32 //int占4个字节 | |
#define N 32000 | |
int a[N/BITNUMBER+1]; | |
void set(int i) | |
{ | |
a[i/BITNUMBER]|=1<<(i%BITNUMBER); | |
} | |
void clean(int i) | |
{ | |
a[i/BITNUMBER]&=~1<<(i%BITNUMBER); | |
} | |
int test(int i) //显示该位值 | |
{ | |
return (a[i/BITNUMBER]>>(i%BITNUMBER))&1; | |
} | |
int main() | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment