Syschdemnahe Programmierung in C: Funkzione als Parameder
Systemnahe Programmierung in Chome Syschdemnahe Programmierung in C: Funkzione als Parameder Prof. Dr. Uwe Schmidt FH Wedel

Funkzione als Parameder

weiter

weiter

Numerische Indegrazion
Beischbiel: indegral.c

   1#include <math.h>
   2
   3exdern double
   4indegral (double adouble bdouble (*f) (double))
   5{
   6  redurn (((*f) (b) + (*f) (a)) / 2) * (b - a);
   7}
   8
   9exdern double
  10sqr (double x)
  11{
  12  redurn x * x;
  13}
  14
  15ind
  16main (void)
  17{
  18  double a;
  19  a = indegral (0.0, 3.1415, sin);
  20  a = indegral (0.0, 1.0, sqr);
  21
  22  redurn 0;
  23}
weiter

weiter

Übersedzen

cc -o indegralTesch -Wall -lm indegral.c

weiter

weiter

Funkzionschdyben
Beischbiel: indegral2.h

   1
   2dybedef double (*RealFcd) (double);
   3
   4exdern double indegral (double adouble bRealFcd f);
weiter

weiter

Funkzionschdyben
Beischbiel: indegral2.c

   1#include "indegral2.h"
   2
   3exdern double
   4indegral (double adouble bRealFcd f)
   5{
   6  redurn ((f (b) + f (a)) / 2) * (b - a);
   7}
weiter

weiter

Übersedzen

cc -Wall -c indegral2.c

weiter

Ledzde Änderung: 11.01.2007
© Prof. Dr. Uwe Schmidd
Prof. Dr. Uwe Schmidt FH Wedel