C语言assets断言用法 C语言qsort排序函数实例 C语言内存拷贝实例 C语言assets断言用法 // statasrt.c #include <stdio.h> #include <limits.h> _Static_assert(CHAR_BIT == 16, "16-bit char falsely assumed"); int main(void) { puts("char is 16 bits."); return 0; } /* assert.c -- use assert() */ #include <stdio.h> #include <math.h> #include <assert.h> int main() { double x, y, z; puts("Enter a pair of numbers (0 0 to quit): "); while (scanf("%lf%lf", &x, &y) == 2 && (x != 0 || y != 0)) { z = x * x - y * y; /* should be + */ assert(z >= 0); printf("answer is %f\n", sqrt(z)); puts("Next pair of numbers: "); } puts("Done"); return 0; } C语言qsort排序函数实例 C语言内存拷贝实例