You'll also want to advance your pointer (str++) in the loop, or else you'll have an infinite loop checking the first character over and over again. Unless, of course, you pass in an empty string, but that doesn't seem too useful.

You also don't need to create new variables for passing in pointers. Your function call can look like: