#include <stdio.h>

#define LEN 6 

void print_chart(float t[2][LEN]);

int main ()
{

   int i;

   /* a 2-D array: an array (length 2)  of arrays (length 6 ) of floats */
   float temp[2][LEN] = {  {0,20,40,60,80,100},       
                           {32,68,122,158,194,212} };


   /* print Celsius and Fahrenheit values in a table*/
   print_chart(temp);
   printf("\n\n");

   /* Cast temp to a pointer-to-float, treat as 1-D array */
   for ( i=0; i<LEN*2; i++) {
     float * pf  = (float *)temp;
     printf("pf[%2d]   : %.1f\n", i, pf[i]);
   }

   return 0;
}

void print_chart(float t[2][LEN])
{
   int i;

   /* print Celsius and Fahrenheit values in a table*/
   printf("C\t");
   for ( i=0; i<LEN; i++) {
     printf("%3.1f\t", t[0][i]);  /* print value from t[1] */
   }
   printf("\n");

   printf("F\t");
   for ( i=0; i<LEN; i++) {
      printf("%3.1f\t", t[1][i]);  /* print value from t[2] */
   }
   printf("\n");
};

