Quote:while (str1[i] != EOF)
It is very unlikely that the loop will end (you didn't store EOF in
- Keep track of the number of read characters, say
and use it in the loop stop condition.
- Change the stop condition to
(str1[i] != '\0').