strcpy() return value

as Evan pointed out, it is possible to do something like

char* s = strcpy(malloc(10), "test");

e.g. assign malloc()ed memory a value, without using helper variable.

(this example isn’t the best one, it will crash on out of memory conditions, but the idea is obvious)

Leave a Comment