Add the include statement of header file string.h, to use the function strlen() and memset() explicitly.
Modify the output argument's type from 'n' to 'i' for printing the port number.