105. Strings and Character Handling-ii

Question.6

A developer writes a custom strcpy for a bare-metal project:

void my_strcpy(char *dst, const char *src) {
   int i = 0;
   while (src[i] != '\0') {
       dst[i] = src[i];
       i++;
   }
}

He calls my_strcpy(buf, "OK") and then printf("%s", buf). What's wrong?

Need Help? Refer to the Quick Guide below

Select Answer