home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / dos / prg / alb_c10 / chap_08 / ch08_07.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-20  |  1.7 KB  |  63 lines

  1. /*********************************************************************
  2. *  CH08_07.C                                           Pointeurs  *
  3. *                   Passage de fonctions comme arguments  *
  4. *********************************************************************/
  5.  
  6. #include<stdio.h>
  7. #include"c:\albulus\chap_07\ctes.h"
  8.  
  9. void affiche_1( double);
  10. void affiche_2( double);
  11. void affiche_3( double);
  12.  
  13. void (*pointeur_sur_fonction)( double);
  14.  
  15. main( void)
  16. {
  17.     affiche_1( C_me);                   /* appel normal    */
  18.     pointeur_sur_fonction = affiche_1;  /* affectation      */
  19.     pointeur_sur_fonction( C_me);       /* appel indirect   */
  20.         printf("\n");
  21.  
  22.     affiche_2( PI);                     /* appel normal    */
  23.     pointeur_sur_fonction = affiche_2;
  24.     pointeur_sur_fonction( PI);
  25.     printf("\n");
  26.  
  27.     affiche_2( C_R);                     /* appel normal    */
  28.     pointeur_sur_fonction( C_R);
  29.     printf("\n");
  30.  
  31.     affiche_3( C_mn);                    /* appel normal    */
  32.     pointeur_sur_fonction = affiche_3;
  33.     pointeur_sur_fonction( C_mn);
  34. }
  35.  
  36. void affiche_1( double rien)
  37. {
  38.    printf("Je n'affiche aucune valeur.\n");
  39. }
  40.  
  41. void affiche_2(double a2)
  42. {
  43.    printf("J'affiche des rΘels sans exposants:  %lf\n", a2);
  44. }
  45.  
  46. void affiche_3(double a3)
  47. {
  48.    printf("J'affiche des rΘels avec exposants: %lE\n", a3);
  49. }
  50. /* 
  51.  
  52.    Je n'affiche aucune valeur.
  53.    Je n'affiche aucune valeur.
  54.  
  55.    J'affiche des rΘels sans exposants: 3.141593
  56.    J'affiche des rΘels sans exposants: 3.141593
  57.  
  58.    J'affiche des rΘels sans exposants: 8.314110
  59.    J'affiche des rΘels sans exposants: 8.314110
  60.  
  61.    J'affiche des rΘels avec exposants: 1.674954E-27
  62.    J'affiche des rΘels avec exposants: 1.674954E-27            */
  63.