Q: This program works correctly, but it dumps core after it finishes. Why?
struct list { char *item; struct list *next; } /* Here is the main program. */ main(argc, argv) { ... }
A: A missing semicolon at the end of the structure declaration causes main to be declared as returning a structure. (The connection is hard to see because of the intervening comment.) Since structure-valued functions are usually implemented by adding a hidden return pointer (see question 2.9), the generated code for main() tries to accept three arguments, although only two are passed (in this case, by the C start-up code). See also questions 10.9 and 16.4.
References:
CT&P Sec. 2.3 pp. 21-2