The General Utilities Library

The general utilities library contains a grab bag of functions, including a random number generator, searching and sorting functions, conversion functions, and memory management functions. Under ANSI C, prototypes for these functions exist in the stdlib.h header file. Appendix F lists all the functions in this family; we'll take a closer look at a few of them now.

The exit() and atexit() Functions

We've already used exit() explicitly in several examples. In addition, the exit() function is invoked automatically upon return from main(). The ANSI standard has added a couple of nice features that we haven't used yet. The most important addition is that you can specify particular functions to be called when ...

Get C Primer Plus®, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.