### Question 16.3

This program crashes before it even runs! (When single-stepping with a debugger, it dies before the first statement in `main`.)

You probably have one or more very large (kilobyte or more) local arrays. Many systems have fixed-size stacks, and those which perform dynamic stack allocation automatically (e.g. Unix) can be confused when the stack tries to grow by a huge chunk all at once. It is often better to declare large arrays with `static` duration (unless of course you need a fresh set with each recursive call, in which case you could dynamically allocate them with `malloc`; see also question 1.31).

(See also questions 11.12, 16.4, 16.5, and 18.4.)

Read sequentially: prev next up top

This page by Steve Summit // Copyright 1995 // mail feedback