Howdy,
I am just learning the c languge from Sam's Teach yourself C.
I am on to Understanding Arrays, there is a question I had that was not answered in the book.
The question was write a program to display the total memory space taken by the array(I understand this part), what I was wondering if you had a array of floating numbers to print the array out would I use a for loop or a while loop, because I cant figure out how to get it to work with a for loop, If i change i to a double or float it still wont work here is my code, And thank you all for your time and your suggestions.
Code:
#include <stdio.h>
main() {
double list_data[6] = {
1.12345,
2.12345,
3.12345,
4.12345,
5.12345,
6.12345};
int i, size;
size = sizeof(list_data);
printf("The size of list_data is %d\n", size);
for (i=0; i<list_data[i]; i++)
printf(" %.5f\n", list_data[i]);
return (0);
}