The output I get for each year range is inf. I'm trying to read into the file and calculating the frequency per hundred thousand, for a name in a specific year range. How can I fix this? Output:

Name?

julie

1921 - 1925: inf

1926 - 1930: inf

1931 - 1935: inf

1936 - 1940: inf

1941 - 1945: inf

1946 - 1950: inf

1951 - 1955: inf

1956 - 1960: inf

1961 - 1965: inf

1966 - 1970: inf

1971 - 1975: inf

1976 - 1980: inf

1981 - 1985: inf

1986 - 1990: inf

1991 - 1995: inf

1996 - 2000: inf

2001 - 2005: inf

Code:

Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct NameRecord {
char name[31];
int year;
int frequency;
};
int getRawData(FILE *fp, struct NameRecord records[], int currSize);
int main() {
struct NameRecord records[150000];
FILE *fp = NULL;
int size = 0, currSize = 0, yearRangeTotal[17], nameTotal[17], year = 0;
char name[31];
double perHundredThousand[17], frequency = 0;
fp = fopen("femalebabynames.csv", "r");
size = getRawData(fp, records, currSize);
printf("Name?\n");
scanf("%s", name);
int i, x;
memset(yearRangeTotal, 0, sizeof(yearRangeTotal));
for(i = 0; i < size; i++) {
x = ((records[i].year - 1) / 5 - 384);
yearRangeTotal[x] =+ yearRangeTotal[x] + records[i].frequency;
}
memset(nameTotal, 0, sizeof(nameTotal));
for(i = 0; i < size; i++) {
x = ((records[i].year - 1) / 5 - 384);
if(strncmp(name, records[i].name, 30) == 0) {
nameTotal[x] =+ nameTotal[x] + records[i].frequency;
}
}
memset(perHundredThousand, 0, sizeof(perHundredThousand));
for(i = 0; i < 17; i++) {
perHundredThousand[i] = 100000.00 / nameTotal[i] * yearRangeTotal[i];
}
for(i = 0; i < 17; i++) {
printf("%.4d - %.4d: %.2f\n", (i+384)*5+1, (i+385)*5, perHundredThousand[i]);
}
printf("\n");
return 0;
}
int getRawData(FILE* fp, struct NameRecord records[], int currSize) {
while(EOF != fscanf(fp,"%d,%[^,],%d", &records[currSize].year, records[currSize].name, &records[currSize].frequency)) {
currSize++;
}
return currSize;
}