The function nc_inq_libvers returns a string identifying the version of the netCDF library, and when it was built.
const char * nc_inq_libvers(void);
This function takes no arguments, and thus no errors are possible in its invocation.
Here is an example using nc_inq_libvers to print the version of the netCDF library with which the program is linked:
#include <netcdf.h> ... printf("%s\n", nc_inq_libvers());