Next: ncmpi_def_var, Previous: Variable Introduction, Up: Variables [Index]
The following table gives the netCDF external data types defined in CDF-1 and CDF-2 and the corresponding type constants for defining variables in the C interface:
| Type | C #define | Bits | Intent of use |
| char | NC_CHAR | 8 | text data |
| byte | NC_BYTE | 8 | 1-byte integer* |
| short | NC_SHORT | 16 | 2-byte signed integer |
| int | NC_INT | 32 | 4-byte signed integer |
| float | NC_FLOAT | 32 | 4-byte floating point number |
| double | NC_DOUBLE | 64 | 8-byte real number in double precision |
The first column gives the netCDF external data type, which is the same as the CDL data type. The next column gives the corresponding C preprocessor macro for use in PnetCDF functions (the preprocessor macros are defined in the netCDF C header-file pnetcdf.h). The third column gives the number of bits used in the external representation of values of the corresponding type.
* NC_BYTE is considered unsigned when calling from _uchar APIs and the file is in either CDF-1 or CDF-2 format. In all other cases, NC_BYTE is considered signed. For more information about this special treatment, see http://www.unidata.ucar.edu/software/netcdf/docs/data_type.html#type_conversion
| Type | C #define | Bits | Intent of use |
| unsigned byte | NC_UBYTE | 8 | unsigned 1-byte integer |
| unsigned short | NC_USHORT | 16 | unsigned 2-byte integer |
| unsigned int | NC_UINT | 32 | unsigned 4-byte integer |
| long long | NC_INT64 | 64 | signed 8-byte integer |
| unsigned long long | NC_UINT64 | 64 | unsigned 8-byte integer |
Next: ncmpi_def_var, Previous: Variable Introduction, Up: Variables [Index]