I am trying to answer a question in my C programming book, but I am not sure if my answer is correct.
The book doesn't provide any answers though. I am new to C programming, and any help will be appreciated.
Question:
Assume you have declared an array as follows:
float data[1000];
Show two ways to initialize all elements of the array to 0.
Use a loop and an assignment statement for one method, and the memset () function for the other.
my current code:
#include <stdio.h>
float data[1000];
main(){
int count;
for (count = 0; count < 1000; count++){
scanf("%f", &data[count]);
}
for (count = 0; count < 1000; count++){
printf("Array %i: %f\n", count, data[count]);
}
}