摘要:
编写函数,返回将无符号整数的第pos位设置为1后的值。 1、 #include <stdio.h> unsigned set(unsigned x, int pos) { return (x | 1 << pos); } int main(void) { unsigned x; int n; put 阅读全文
摘要:
1、 #include <stdio.h> unsigned rrotate(unsigned x, int n) { printf("rrotate = %u\n", x >> n); } unsigned lrotate(unsigned x, int n) { printf("lrotate 阅读全文
摘要:
1、 #include <stdio.h> #include <math.h> int main(void) { unsigned x; int n; puts("please input an unsigned number and an integer."); printf("x = "); s 阅读全文
摘要:
c语言中按位逻辑运算符、位移运算符 #include <stdio.h> int count_bits(unsigned x) { int bits = 0; while(x) { if(x & 1U) bits++; x >>= 1; } return bits; } int int_bits(v 阅读全文
摘要:
c语言中按位逻辑运算符、位移运算符 #include <stdio.h> int count_bits(unsigned x) { int bits = 0; while(x) { if(x & 1U) bits++; x >>= 1; } return bits; } int int_bits(v 阅读全文
摘要:
#include <stdio.h> int count_bits(unsigned x) { int bits = 0; while(x) { if(x & 1U) bits++; x >>= 1; } return bits; } int int_bits(void) { return coun 阅读全文
摘要:
1、 #include <stdio.h> int main(void) { int n; printf("sizeof(1) = %u\n", (unsigned)sizeof(1)); printf("sizeof(+1) = %u\n", (unsigned)sizeof(+1)); prin 阅读全文
摘要:
1、 #include <stdio.h> void fun(void) { static int times = 0; times++; printf("put_count: %d\n", times); } int main(void) { int n; puts("please input a 阅读全文
摘要:
1、 #include <stdio.h> #define NUMBER 5 int main(void) { static double array[NUMBER]; int i; for(i = 0; i < NUMBER; i++) { printf("array[%d] = %.1f\n", 阅读全文
摘要:
1、 #include <stdio.h> void sumup(int x[2][4][3], int y[4][3]) { int i, j, k; for(i = 0; i < 4; i++) { for(j = 0; j < 3; j++) { for(k = 0; k < 2; k++) 阅读全文