编写reset函数,返回无符号整数x的第pos为设为0后的值。
1、
#include <stdio.h>
unsigned reset(unsigned x, int pos)
{
return (x & (~(1 << pos)));
}
int main(void)
{
unsigned x;
int n;
puts("please input two nonnegative integers.");
printf("x = "); scanf("%u", &x);
printf("n = "); scanf("%d", &n);
printf("result: %u
", reset(x, n));
return 0;
}