Ok, well here is the function it is occuring in. I think since the function is essentially self contained it should illustrate what I am trying to do nicely.

As per an explaination. My data is organized into a bunch (upto 500) folders all in one Master folder. This program runs in the master folder and enters each sub folder, opens a file in there. The file contains the id numbers of particles in a system which we have determined to be "crystalline" in our simulation. Essentially I want the array arry, to contain a count of how many times each particle is infact crystalline.

Code:
void givePropPercentages(int num_prop, char *name){

	FILE *fileptr;
	float arry[NUM_PARTICLES];
	char dirname[5], output[12];
	float tmp2;
	
// initalize the array to zero
	for (int i = 0; i<NUM_PARTICLES; i++){arry[i]=0;}

// now we loop over all folders	
	for(int i=1;i<=num_prop; i++){
		
		sprintf(dirname,"%d",1000+i); // this is just a numbering standard
                                                             //  the folders start at 1001
		chdir(dirname);
		
		fileptr = fopen(name, "r"); // open the file with the constant name
                                                       // since all folders have one file of this name in them
	/*the loop which is giving me issues */
		while (fscanf(fileptr,"%f", &tmp2) != EOF) {
			printf("\n\nIncrementing Particle %d", tmp2);
			arry[(int)tmp2]=arry[(int)tmp2]+1;
			
		}
		
		fclose(fileptr); // close the file
		chdir("../");    // navigate back out to master folder
	}
	
	
/* this is where we actually do somethign with the data
     we create a new file which will hold the percentage of
     the total number of runs in which each particle is in fact crystalline

 */
       printf("\n\n Name the Prop. Percentage output file (12 chars max): ");
	scanf("%s", output);
	
	fileptr = fopen(output,"w");
	
	for (int i = 0; i<NUM_PARTICLES; i++){
		
		arry[i] = arry[i]/num_prop;
		printf("%f\n", arry[i]);
		fprintf(fileptr,"%f\n", arry[i]);
	
	}

}
/*end function*/
This all compiles nicely, you can just put a function call in main(), and assuming you have the correct file tree set up everything runs nicely except my final output file, the one which is supposed to hold the percentages just contains all zeros.