Originally Posted by
Sorin
I'm trying to start reading code other than my own....so at first glance after your post grumpy....what about the second line? Shouldn't that "buffer" say "numbers" instead? It looks to me to be the intended operation, and I don't see where buffer is defined.
I was doing some test. Buffer in memset is suppose to be numbers. And thanks grumpy I realized it's an array of 1000 doubles. I was used to creating char pointers and never really created an array this way before.
Code:
double numbers[1000];
memset (numbers, 0, sizeof (numbers));
int count = 0;
for (int i = 0; ; ++i) {
int return_value = scanf ("%lg", &numbers[i]);
if (return_value == EOF) break;
++count;
}
for (int i = 0; i < count; ++i) {
printf ("%g\n", numbers[i]);
}