#include <stdio.h> void custom_strcpy(char *dest, const char *src) { int index = 0; while(*(src + index) != '\0') { *(dest+index) = *(src+index); index++; } *(dest+index) = '\0'; // Your logic here } int main() { char src[101]; char dest[101]; fgets(src, sizeof(src), stdin); // Remove newline int i = 0; while (src[i] != '\0') { if (src[i] == '\n') { src[i] = '\0'; break; } i++; } custom_strcpy(dest, src); printf("%s", dest); return 0; }
Test Cases
Test Results
Input
firmware
Expected Output