4.5 Standard C Functions

In the NINTENDO64 Developer's Kit where Nusystem exists, the nustd library, which is a subset library of standard C language functions, is included.

It is beyond the scope of this tutorial to explain the whole nustd library, but some representative functions will be introduced. If you would like to read about the functions in detail, see the Standard Function Reference in the NuSystem section of Allmanual. Library functions relating to memory include memcpy, memset and memcmp. Functions for manipulating character strings include strlen and strcat. You can compare character strings with the strcmp function, and you can convert between character strings and numeric values using the atoi, atoland atof functions.

The library also defines routines like malloc, free and realloc for reserving/freeing memory, but make sure to call the InitHeap function to reserve the heap area before you use any of these routines.

The whole set of general-use math functions needed for graphics operations and physical computations are also defined. The list includes sin, cos, tan, exp, log, log10, pow and sqrt.

However, a substantial group of standard C functions are contained in libnustd.a as well as the debug version of this library, called libnustd_d.a, so remember to link one of these libraries.