I know this is perhaps a dumb question. I can’t find the code for strcpy() any where, anybody got any suggestions?
I have looked in string.h and cstring but can’t find the code. I am using
MS Visual C++ v8 and can get the function to work but want to have a look at the code.
Just in case you are wondering why I want to look at the code, I am working through a book on C++ and it asks you to implement your own version of strcpy() and then compare it to the standard library version.
My version,
No I didn't come up with that myself (far to clever for me), but I think I understand how it works.Code:void strcopy(const char* str1, char* str2) { while(*str2++ = *str1++); }
During my many searches of Google for information on this problem I have come across the fact that strcpy() is supposed to return a char*, why is this useful?