You have to zero out arr before accumulating your counts.
how to i do that
actually i thought i already did that by arr[i-32]???
Code:memset(arr, 0, sizeof(arr));
i tried to put that at the begging and end of the count and it didnt work
Is memset a function like fileopen? If it is, is there a different function we can use besides memset, like fileopen?
@TMK: There is no function fileopen. If you mean fopen, then yes, memset is a built in function (in <string.h>, for whatever reason).
@marvin: You wouldn't want to reset at the end -- you'd just undo all the work that you just did.
I think you are under the impression that that sentence means something. Regrettably, it does not. Obviously fopen and memset are completely different things (one opens a file on disk, the other sets a piece of memory to 0), so you can't substitute one for another. Nor is there a way around using fopen that I can see (certainly not in this program), apart from using OS-specific file functions.
all i want to know is why when i print out the characters frequecys i get addresses instead of the actual frequency. i zeroed out the array with arr[i-32] but i still dont understand why i get addressses for about 32 of them
Because you don't. You get "random uninitialized data plus my count", which for all intents and purposes is indistinguishable from "random uninitialized data".
There is nothing in that statement that could possibly zero out an array. Now if you started by saying arr[i-32] =0, then you'd be zeroing out an array. And note that you want to do that for every possible i, before you start counting.i zeroed out the array with arr[i-32]
well i am gettting like huge numbers that are suppose to be in the array where i am looking and printing so i assume that it is addresses....maybe not...look at the code and tell me what i am doing wrong..
i get a compile error when i equate it to zero....invalid initializer