I\'m stuck on a HW assignment where I\'m required to write a program that transforms a bunch of English words (in a list separated by new lines in a input .txt file) into a bunc
There are a variety of oddities in this code, but the problem you're asking about is created by your while loop in convertToPigLatin. You loop while *strPtr != '\0', and \n is certainly not \0, so you are adding that to pStr.
Now for the rest of the code, just a few comments:
strncat to copy one character is odd usage. Typically, one would use simple character assignment instead (as in str1[i] = str2[j])*strPtr++ is incrementing the pointer and dereferencing it, but then doing nothing with the dereferenced value. You just want strPtr++ there.char str[] = "some string". You don't need to use array initialization syntax.Those are the ones that jumped out at me without a detailed reading. Good luck on your future assignments.
Edit to add that stepping through your code with a debugger is very valuable in these cases. You would see exactly where the newline is being added.