I've been tearing apart my program for hours trying to find the program. I've finally limited it to just a couple lines of code, but still I'm still stupid (or tired) to find the issue.
All it is is a string copy function using pointers. Can someone look it over?
void stringCopy(char *sourcePtr, char *destPtr)
{
while(*sourcePtr!='\0')
{
*destPtr=*sourcePtr;
destPtr++;
sourcePtr++;
}
}
It's injecting garbage values into my strings, like I'm somehow going out of the limits of the string.
Also, it's only used to copy strings of length less than 10. The declared source and destination arrays are of size 20. Everything is hard-coded.
I would use strcpy but this is an assignment for a class and it's not allowed.
EDIT: I simply forgot to input the final null char into the destination! Sorry for all the trouble, guys!