You may want to check whether scanf null terminates the string it reads in from stdin. If it does not, then you should initialize your char array that holds you input from the user. Use memset() for this. You may be walking off the end of your array, when strlen is looking for the null terminating character in the input supplied.
No comments:
Post a Comment