/* --------------------------------------------------------------------- ** Figure 10.4: The sizeof an array. ** --------------------------------------------------------------------- */ #include #define DIMP 5 #define DIMT 6 #define DIMV 3 void main( void ) { float pressure[DIMP] = { .174, 23.72, 1.111, 721.2, 36.3 }; short int temps[DIMT] = { 3, 18, 76, -2 }; double vec2[DIMV] = { 2.0, 0.0, 1.0 }; printf ( " pressure: sizeof(float) is %li * length %i = sizeof array %li \n", sizeof(float), DIMP, sizeof(pressure) ); printf ( " temps: sizeof(short) is %li * length %i = sizeof array %li \n", sizeof(short), DIMT, sizeof(temps) ); printf ( " vec2: sizeof(double) is %li * length %i = sizeof array %li \n", sizeof(double), DIMV, sizeof(vec2) ); }