Many functions from the C standard library, especially those used to process strings, and in particular strcpy (), use the following prototype:
char *the_function (char *destination, ...)
The return value of these functions actually matches the return value of destination . Why would you spend the return value on something redundant? This means that such a function is invalid or returns something useful.
My only suggestion why this is so is it is easier and more convenient to insert a function call into another expression, for example:
printf("%s\n", strcpy(dst, src));
Are there any other reasonable reasons to justify this idiom?
c function strcpy
Blagovest Buyukliev Aug 24 2018-10-10T00: 00Z
source share