Macros: define

Good for maintainability...

/* Programme to illustrate use of macros --- conversion of Fahrenheit to 
   Centigrade/Celsius : */

#define LOWER 0      /* lower limit of table */
#define UPPER 300    /* upper limit */
#define STEP  20     /* step size */

/* print table : */

main () {
    int fahr;

    for (fahr = LOWER;  fahr <= UPPER;  fahr = fahr + STEP)
        printf("%3d %6.1f\n", fahr, (5.0/9.0)*(fahr - 32));
  }


...previousup (conts)next...



About this document:

Produced from the SGML: /home/isd/public_html/_course_crash_in_c/_reml_grp/index.reml
On: 3/3/2003 at 17:43:41
Options: reml2 -i noindex -l long -o html -p multiple