I have run your code successfully, and the output is different from yours.
I guess the error is somewhere outside this function.
Also, could you send me you input file?
You should use debugging tools to find the error more easily.
User Profile
Collapse
-
The image is too small to see. Actually, even if i can see it clearly, i can't tell you what the error is, because there is not enough information.
According to your code, i saw that the upper bound of loop is 256, while the array size is 256. Correct it to 255.
Also, change the print loop as the following code, run it and show me last output lines (3 lines at most).
...Code:cout<<"\nThe character frequencies are:
Leave a comment:
-
Could you debug this and show me the line where the program stopped?Leave a comment:
-
Because your array has only 255 elements, the max index is 254. So the loop must be like this
orCode:for(int count = 0; count <= 254; count++)
You get segmentation fault when you access the element that is not in arrayCode:for(int count = 0; count != 255; count++)
Leave a comment:
-
pthread_mutex_unlock() returns 1
When I use pthread_mutex_u nlock(), it returns value 1, which means EPERM or 'Operation not permitted'. The strange thing is it happens when my program have been executed for a while.
I have searched the solution, and some results say that something is wrong with memory.
Any suggestion?
No activity results to display
Show More
Leave a comment: