Since i am extremely bored, and i have been staring into lots of code recently .. i have no intention to do this in the blog .. so this weeks problem will be about the shortest code ever ..
ok .. go on .. i need the Shortest implementation of..
yeah.. strcpy().. our strcpy().. 😉
void strcpy(char *destination, const char *source);
any language is welcome .. but C/C++ are preferred.
any library functions or classes are absolutely not welcome..
i don’t care for the return .. keep it void
the function must take 2 arguments, one is the destination string and the other is the source string .. you can assume that both are valid (not null) pointers nor empty strings.. so forget your QA sprit for a while
all strings are “null terminated char arrays”.. very normal “C strings”.
input string must be kept intact, you can notice const char *
read the first comment about the const char * 😀
send me CODE .. and only CODE .. you can explain it , you can comment it .. but don’t send ideas alone 😀 .. try to code it 😀 .. this is the challenge.
for the new faces .. welcome! 😀 .. you post the solution in the comments, and if it is right i will not approve it until it’s time, otherwise, i will approve it and say what went wrong.. that’s why you should read the comments before posting a solution.
after we are done ان شاء الله.. i will show you how to make use of a couple of features in C++ to solve this problem .. one of them is EXTREAMELY annoying feature..
OK .. That’s it .. let the race .. begin .. 😀
the solution can be found here