I am using comm port for serial communication between 2 PC's
using C language. Once I have initialized the COMM port, Is there any
option of closing the port in C language.
There is no option in C itself to open a communications port.
C defines only operations on files and idealized byte streams,
not on interactive devices. Thus, any work you are doing to
initialize a communications port is platform dependant, and
the means to close the port is platform dependant as well.
Mostly (but not universally), the way to close a communications
port is to close the I/O handle associated with it.
If you are to read and write from the port by passing a FILE*
to the I/O routines, then you would likely fclose() passing in the
FILE*.
If you are to read and write from the port by passing an integer
('file descriptor') indicating the device number, then you would
likely close() passing in the integer. Note: close() is not part
of C itself, but is very common.
If you are calling special I/O routines in order to do I/O transactions
[e.g., kbin()] then you really have to check the documentation for
your platform as to how to close the device.