I am writing a function that determines whether a string contains only alphanumeric characters and spaces. I am effectively testing whether it matches the regular expression
Looks good to me, but you can use isalnum(c) instead of isalpha and isdigit.
isalnum(c)
isalpha
isdigit