Quote Originally Posted by cooper1200 View Post
Is it possible that as Salem said the first string isn't terminated so the first while loop is operating on both strings?? IE the second string is right after the first one in memory so effectively the first function is passed abcdABCD......................./0 where the rest isn't printed as they aren't valid characters?? Hence why the op's second version appears to behave as expected because the second string hasn't been created when the first string is printed.
Those were my initial thoughts, Salem had the correct answer. All arrays need to at least have the additional space for the null pointer for them to function properly. I've tested both of these and they both make the program run in the way I intended:

Code:
int main()
{
  char one[5] = {'a', 'b', 'c', 'd'};
 
  char two[5] = {'A', 'B', 'C', 'D'};
 
  upperString(one);
 
  lowerString(two);
}
Code:
int main()
{
  char one[5] = {'a', 'b', 'c', 'd', '\0'};
 
  char two[5] = {'A', 'B', 'C', 'D','\0'};
 
  upperString(one);
 
  lowerString(two);
}
Idk why I thought doing it the way of the answer above was acceptable, i think it's maybe because gcc normally complains when you have a mis-matched number of elements reserved with the number of slots you declare, so I thought it was just putting the null terminator in there for me this whole time.

Quote Originally Posted by stahta01 View Post
You need to pass the array size to the functions

In other words,
Code:
while(one[z])
Is not valid/safe code.

Tim S.
That's fine for you to point that out and all, but I can't do anything with that information. I appreciate your interest.