void array(arr) {
int i;
double sum = 0, product = 1;
for (i = 0; i < strlen(arr); i++) {
sum = sum + arr[i];
product = product * arr[i];
}
printf("%f", sum);
printf("%f", product);
}
double arr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
array(arr);
void array(double *arr, int size) {
int i;
double sum = 0, product = 1;
for (i = 0; i < size; i++) {
sum = sum + arr[i];
product = product * arr[i];
}
printf("%f", sum);
printf("%f", product);
}
int main() {
double arr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
array(arr, sizeof(arr)/sizeof(arr[0]));
return 0;
}