#include #include /* shows how a fixed size array is not flexible */ #define LEN 5 int main() { int temps[LEN]; int i; int num_in_array; char str[BUFSIZ]; i = 0; while ( 1 ){ printf("Next temp (or Enter when done)? "); fgets( str, BUFSIZ, stdin); if ( str[0] == '\n' ) break; temps[i] = atoi( str ); i++; } num_in_array = i; // now print the list for ( i = 0; i < num_in_array; i++ ) printf(" %d", temps[i]); putchar('\n'); return 0; }