C库函数 longjmp() #include <stdio.h> #include <stdlib.h> #include <setjmp.h> int main () { int val; jmp_buf env_buffer; /* save calling environment for longjmp */ val = setjmp( env_buffer ); if( val != 0 ) { printf("Returned from a longjmp() with value = %s\n", val); exit(0); } printf("Jump function call\n"); jmpfunction( env_buffer ); return(0); } void jmpfunction(jmp_buf env_buf) { longjmp(env_buf, "codingdict.com"); }
C库宏 setjmp() #include <stdio.h> #include <stdlib.h> #include <setjmp.h> int main () { int val; jmp_buf env_buffer; /* save calling environment for longjmp */ val = setjmp(env_buffer ); if( val != 0 ) { printf("Returned from a longjmp() with value = %s\n", val); exit(0); } printf("Jump function call\n"); jmpfunction(env_buffer ); return(0); } void jmpfunction(jmp_buf env_buf) { longjmp(env_buf, "codingdict.com"); }
C库函数 fabs() #include <stdio.h> #include <math.h> int main () { int a, b; a = 1234; b = -344; printf("The absolute value of %d is %lf\n", a, fabs(a)); printf("The absolute value of %d is %lf\n", b, fabs(b)); return(0); }
C库函数 sqrt() #include <stdio.h> #include <math.h> int main () { printf("Square root of %lf is %lf\n", 4.0, sqrt(4.0) ); printf("Square root of %lf is %lf\n", 5.0, sqrt(5.0) ); return(0); }
C库函数 ldexp() #include <stdio.h> #include <math.h> int main () { double x, ret; int n; x = 0.65; n = 3; ret = ldexp(x ,n); printf("%f * 2^%d = %f\n", x, n, ret); return(0); }