Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
any problems with this code
Folks, I have been told that there is one logical problem with this code. Basically, this is an implementation of the library function strcat().
The intended beahviour of this function to concatenate ct to the end of s. Return s.
I could not find any logical problems with the code, apart from the fact that the final string should be NULL terminated, but I am not sure that can be classified as an error.
Could you help me find the error, if there is any.
char *strcat(char *s, const char *ct)
int i, start;
start = strlen(s);
for (i = 0; i < strlen(ct); i++)
s[start + i] = ct[i];