I am having difficulties reading out the array properly. I believe my function is reading and adding an 's' to every letter instead of at the very end. I have no idea how to go about correcting the problem. Any tips?
This is what I am getting when running the program
1 2 3 4
Enter word:
tom
╠╠╠
Press any key to continue . . .
In this piece of code, you are accessing the same index over and over,then saying it is equal to "orig[index + 1] + 's' ". After such act, you set its value to null('\0'),quite redundant.
1 2 3 4 5 6 7 8 9 10 11
void addS(constchar orig[], char plural[])
{
for (int i = 0; i < index; i++)
{
plural[index] = orig[index+1] + 's';
plural[index] = '\0';
}
}