1. re sizing a vector

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)

2. check the return value of scanf to determine when there are no more numbers. then just keep the count of numbers in a variable.
Code:
```for(a=0;a<100;a++) {
status = scanf("%f",&kms[a]);
if (status <= 0) break;
}```
after the break, the variable 'a' has the actual number of values.
scanf will return 0 if the file has data but it can't be converted to a floating point number
scanf will return less than 0 at end of file