1 2 3 4 5 6 7 8 9 10 11 12 | unsigned int ui_one = 1; signed int i_one = 1; signed short s_minus_one = -1; if (s_minus_one > ui_one) printf(“-1 > 1 \n”); if (s_minus_one < i_one) printf(“-1 < 1 \n”); #./run # # -1 > 1 # -1 < 1 |
1 2 3 4 5 6 | extern void foo(void); void (*f)(); f = &foo; // 合法 f = foo; // 同样合法!(语法糖) f(); // 调用f (*f)(); // 同样调用了f(语法糖) |
1 2 3 4 5 6 7 8 9 10 11 | int array[] = {0, 1, 2, 3, 4}; int *pointer = array; if (sizeof array == sizeof pointer) printf(“This will never be printed!!”); if (sizeof(int *) == sizeof &array[0]) printf(“This will be printed!!\n”); if (&array[2] - &array[0] == 8 ) printf(“This will never be printed either, result is 2 not 8!!”); |
欢迎光临 openKylin论坛 (https://forum.openkylin.top/) | Powered by Discuz! X3.3 |