回复 4楼 rjsp
#include<stdio.h>
unsigned int reverse_bits(unsigned int value){
int c=sizeof(value);
char a[c];
int i=0,n=0,m=0,t=0,h=0;
while(h<c){
if(value&1)
a[i]=1;
else
a[i]=0;
i++;
value>>=1;
h++;
}
for(t=0;t<c;t++){
printf("%d ",a[t]);
t++;
}
printf("\n");
while(n<c/2){
a[c-n-1]=a[n];
n++;
}
for(m=0;m<c;m++){
printf("%d ",a[m]);
m++;
}
printf("\n");
return value;
}
int main(){
unsigned int a=5,b;
b=reverse_bits(a);
printf("%d\n",b);
}