User Profile

Collapse

Profile Sidebar

Collapse
anhpnt
anhpnt
Last Activity: Nov 10 '10, 04:09 AM
Joined: Dec 7 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • 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.
    See more | Go to post

    Leave a comment:


  • 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:
    ...
    See more | Go to post

    Leave a comment:


  • Could you debug this and show me the line where the program stopped?
    See more | Go to post

    Leave a comment:


  • Because your array has only 255 elements, the max index is 254. So the loop must be like this
    Code:
    for(int count = 0; count <= 254; count++)
    or

    Code:
    for(int count = 0; count != 255; count++)
    You get segmentation fault when you access the element that is not in array
    See more | Go to post

    Leave a comment:


  • anhpnt
    started a topic pthread_mutex_unlock() returns 1
    in C

    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?
    See more | Go to post
No activity results to display
Show More
Working...