The netCDF example programs show how to use netCDF.
In the netCDF distribution, the “examples” directory contains examples in C, Fortran 77, Fortran 90, C++, and CDL. There are three sets of example programs in each language. Each language has its own subdirectory under the “examples” directory (for example, the Fortran 77 examples are in “examples/F77”).
The examples are built and run with the “make check” command. (For more information on building netCDF, see The NetCDF Installation and Porting Guide).
The examples create, and then read, three different example files, of increasing complexity.
The corresponding examples in each language create identical netCDF data files. For example, the C program sfc_pres_temp_wr.c produces the same data file as the Fortran 77 program sfc_pres_temp_wr.f.
For convenience, the complete source code in each language can be found in this tutorial, as well as in the netCDF distribution.