#include <stdio.h>
#include <stdlib.h>
float valor(float *k, int t){
float soma = 0;
for (int i = 0; i < t; i++){
soma += k[i];
}
return soma;
}
int main() {
int quant;
printf("Digite a quantidade: "); float *vTotal
= malloc(quant
* sizeof(float)); for(int i = 0; i < quant; i++){
printf("Digite o valor %d: ", i
+ 1); }
float teste = valor(vTotal, quant);
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCmZsb2F0IHZhbG9yKGZsb2F0ICprLCBpbnQgdCl7CglmbG9hdCBzb21hID0gMDsKCWZvciAoaW50IGkgPSAwOyBpIDwgdDsgaSsrKXsKCQlzb21hICs9IGtbaV07Cgl9CglyZXR1cm4gc29tYTsKfQoKaW50IG1haW4oKSB7CglpbnQgcXVhbnQ7CglwcmludGYoIkRpZ2l0ZSBhIHF1YW50aWRhZGU6ICIpOwoJc2NhbmYoIiVkIiwgJnF1YW50KTsKCWZsb2F0ICp2VG90YWwgPSBtYWxsb2MocXVhbnQgKiBzaXplb2YoZmxvYXQpKTsKCWZvcihpbnQgaSA9IDA7IGkgPCBxdWFudDsgaSsrKXsKCSAgICBwcmludGYoIkRpZ2l0ZSBvIHZhbG9yICVkOiAiLCBpICsgMSk7CgkgICAgc2NhbmYoIiVmIiwgJnZUb3RhbFtpXSk7Cgl9CiAgICBmbG9hdCB0ZXN0ZSA9IHZhbG9yKHZUb3RhbCwgcXVhbnQpOwogICAgcHJpbnRmKCJcbiAlLjJmIiwgdGVzdGUpOwogICAgZnJlZSh2VG90YWwpOwp9