Rather than using a c-style array you could read the file into std::vector<double>. That way you don't need to make any a-priori assumption about the number of months' data in the file or how big a vector you need. You could std::vector::reserve() some size beforehand if you have an idea about the number of months or else if the # of months is not too large std::vector::push_back() should be sufficient …
the return value of the function, which returns int in the header but says return 0 within the function body – this needs to be corrected – it'd probably be the average rainfall per month (in which case return type should be double) or number of months for which rainfall data was recorded (in which case size_t return type could also work) – either of these can be gleaned from the vector quite easily