Shailendra B. answered 03/16/19
Software technical lead with 28 years experience in Embedded/Linux/C
The strdup() will take the input string, calculate its size, allocate heap memory for it and copy the input string (including terminating 0) to the new block of memory. It returns this new block of memory which is a duplicate of the input string.