Code:
int stringLength(char* data)
{
while(*data)
{
strLength++;
}
return strLength;
}
This doesn't look right. First, you're not increasing the data pointer at each step so you're looking at the first element all the time.
Second, you should compare with \0 (String NULL terminator). I don't know if \0 is the same as 0 (the number) but I'd use \0 anyway.
Code:
*sourceString++ = *destinationString++;
This is a matter of taste. I prefer not doing several things in the same statement (copy data and increase the pointers). I'd split them to several lines:
Code:
*sourceString = *destinationString;
sourceString++;
destinationString++;
It's a lot easier to see what happens first(the assignment or the addition).
Code:
readData(&data[maxCharacters]);
This will point to the character after the last charcacter in the string, which is the NULL terminator, meaning that there is no space to enter a string. Simply call
readData(&data[0]);
or even better
readData(data);
instead