Define constant in Macro for loop control : Macro Constant « Macro Preprocessor « C / ANSI-C






Define constant in Macro for loop control

Define constant in Macro for loop control
#include <stdio.h>

#define count 31
int main() {
    int heat[count];
    int i;
    float celsius;
    
    for(i = 0; i < count; i++) {
        celsius = ( 5.0 / 9.0 ) * ( heat[ i ] - 32);
        printf("%d \t \t%6.2f \n", heat[ i ], celsius);
    }
}


           
       








Related examples in the same category

1.Use Macro
2.Define Macro: TRUE and FAlSE
3.Define macro: constant
4.Define constant in MacroDefine constant in Macro
5.Define Macro and use it as the loop condition
6.Define macro inside the main function
7.Define macro for string and output
8.Define marco based calculation
9.Define header file name in macro