What's the use of memset() return value? What's the use of memset() return value? c c

What's the use of memset() return value?


It may be used for call chaining like:

char a[200];strcpy(memset(a, 0, 200), "bla");


The signature is in line with all the other similar functions: memcpy(), strcpy() etc. I always thought this was done to enable one to chain calls to such functions, and to otherwise use such calls in expressions.

That said, I've never come across a real-world situation where I would feel compelled to use the return value in such a manner.


In order to use the function as an argument for another function such as sprintf