C examples for Function:Utility Function
Use assert() to check value
#include <stdio.h> #include <math.h> #include <assert.h> int main(){/*from ww w .ja v a2s . c om*/ 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 = -2; assert(z >= 0); printf("answer is %f\n", sqrt(z)); puts("Next pair of numbers: "); } return 0; }