Mega Code Archive

 
Categories / C / Macro Preprocessor
 

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);     } }