IHYPRESS PROGRAMMING
Tutorials and C programs with code and output for beginners
c programming
HOME | ASP | C | CSS | GNUPLOT | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
CAdvanced Functions : Function as Parameter
<06.09>
#include <stdio.h> #include <math.h> // evaluates a function with one argument void evaluate(double f(double f_arg), double pt1, double pt2, double pt3) { printf("f(%.5lf) = %.5lf\n", pt1, f(pt1)); printf("f(%.5lf) = %.5lf\n", pt2, f(pt2)); printf("f(%.5lf) = %.5lf\n", pt3, f(pt3)); } int main (void) { printf ("Square Root\n"); evaluate (sqrt, 25.0, 49.0, 16.0); printf ("\nDecimal Log\n"); evaluate (log10, 25.0, 49.0, 16.0); return (0); }
Hergestellt in Deutschland / Made in Germany
Square Root f(25.00000) = 5.00000 f(49.00000) = 7.00000 f(16.00000) = 4.00000 Decimal Log f(25.00000) = 1.39794 f(49.00000) = 1.69020 f(16.00000) = 1.20412
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland