so the exercise asks to develop a function that reads values from a .txt and write them into an array. The function has to return the number of values read.The only thing i know is that the array maximum lenght is 100. So i need to create a vector with 100 numbers,put the numbers from the txt into the vector,but then how do i resize the vector to have only the number of the values that are in the .txt ?

for(a=0;a<100;a++)

scanf("%f",&kms[a]);

if i could exit this loop when there were no values left, it was done, but i couldn't exit it. Other way i think is using malloc function,but i dont understand how to use it.How can i solve this ?

int ler_quilometros(float *kms)