\0 must be present at the end. \n can be present in the string, just as with any other character. Input from fgets may have an \n at the end, depending on how many characters the user typed.