So, I'm getting a segmentation fault I can't solve. I have this code, with print statements to show where the program quits.
Code:
i = 0;
	while(i<2000){
		printf("Host name %s : %i \n i is %i\n", hostCon[i].hostName, hostCon[i].freq, i);
		fprintf(host_freq, "%i\n", hostCon[i].freq);
		printf("hi1\n");
		fprintf(host_name, "%s", hostCon[i].hostName);
		printf("hi2\n");
		i++;
		}
	printf("out of for loop");
And the print looks like this:

Host name *******.com
: 1
i is 1999
hi1
hi2
Segmentation fault


It seems odd to me, because after the "hi2" the while loop should be finished, thus the next print statement should I appear. I don't understand how this segmentation fault occurs when there is nothing in between the two print statements. Let me know if more code is necessary to debug this. Thanks in advance.