This document is obsolete.

The HTML version of the comp.lang.c FAQ has been taken over by the FAQ's author, Steve Summit.

comp.lang.c Frequently Asked Questions

Please update your links, and thanks -

Frequently Asked Questions in comp.lang.c

[Last modified August 1, 1995 by scs.]

WARNING: A major update to this FAQ list is imminent, probably on September 1, 1995. Many questions will be rearranged and renumbered; the sections may be rearranged and renumbered, also. If you're in the habit of referring people to "question m.n in the FAQ list" or even "section m in the FAQ list," they may be confused if they have a newer version than this one. During the changeover, the safest way to refer people to sections is by name ("the section on memory allocation"). There isn't a good symbolic way to refer to a particular question, but if you mention what the question is about, your recipient should be able to find it.

Certain topics come up again and again on this newsgroup.  They are good questions, and the answers may not be immediately obvious, but each time they recur, much net bandwidth and reader time is wasted on repetitive responses, and on tedious corrections to the incorrect answers which are inevitably posted.

This article, which is posted monthly, attempts to answer these common questions definitively and succinctly, so that net discussion can move on to more constructive topics without continual regression to first principles.

No mere newsgroup article can substitute for thoughtful perusal of a full-length tutorial or language reference manual.  Anyone interested enough in C to be following this newsgroup should also be interested enough to read and study one or more such manuals, preferably several times.  Some C books and compiler manuals are unfortunately inadequate; a few even perpetuate some of the myths which this article attempts to refute.  Several noteworthy books on C are listed in this article's bibliography Many of the questions and answers are cross-referenced to these books, for further study by the interested and dedicated reader (but beware of ANSI vs. ISO C Standard section numbers; see question 5.1).

If you have a question about C which is not answered in this article, first try to answer it by checking a few of the referenced books, or by asking knowledgeable colleagues, before posing your question to the net at large.  There are many people on the net who are happy to answer questions, but the volume of repetitive answers posted to one question, as well as the growing number of questions as the net attracts more readers, can become oppressive.  If you have questions or comments prompted by this article, please reply by mail rather than following up -- this article is meant to decrease net traffic, not increase it.

Besides listing frequently-asked questions, this article also summarizes frequently-posted answers.  Even if you know all the answers, it's worth skimming through this list once in a while, so that when you see one of its questions unwittingly posted, you won't have to waste time answering.

This article was last modified on August 1, 1995, and its travels may have taken it far from its original home on Usenet.  It may now be out­of­date, particularly if you are looking at a printed copy or one retrieved from a tertiary archive site or CD­ROM.  You can always obtain the most up­to­date copy by anonymous ftp from sites,, or (see questions 17.12 and 17.33), or by sending the e­mail message "help" to This article was produced for free redistribution. You should not need to pay anyone for a copy of it.

Other versions of this document are also available.  Posted along with it are an abridged version and (when there are changes) a list of differences with respect to the previous version.  A few preliminary hypertext versions are available on the world­wide web (WWW); see URL's
<> and
<>.  Finally, for those who might prefer a bound, hardcopy version (and even longer answers to even more questions!), a book­length version will be published by Addison­Wesley in November, 1995 (ISBN 0-201-84519-9).

This article is always being improved.  Your input is welcomed.  Send your comments to .

The questions answered here are divided into several categories:

  1. Null Pointers
  2. Arrays and Pointers
  3. Memory Allocation
  4. Expressions
  5. ANSI C
  6. C Preprocessor
  7. Variable-Length Argument Lists
  8. Boolean Expressions and Variables
  9. Structs, Enums, and Unions
  10. Declarations
  11. Stdio
  12. Library Subroutines
  13. Lint
  14. Style
  15. Floating Point
  16. System Dependencies
  17. Miscellaneous (Fortran to C converters, YACC grammars, etc.)


American National Standard for Information Systems -- Programming Language -- C, ANSI X3.159-1989 (see question 5.2).
Jon Louis Bentley, Writing Efficient Programs, Prentice-Hall, 1982, ISBN 0-13-970244-X.
Samuel P. Harbison and Guy L. Steele, C: A Reference Manual, Second Edition, Prentice-Hall, 1987, ISBN 0-13-109802-0.  (A third edition has recently been released.)
Mark R. Horton, Portable C Software, Prentice Hall, 1990, ISBN 0-13-868050-7.
Brian W. Kernighan and P.J. Plauger, The Elements of Programming Style, Second Edition, McGraw-Hill, 1978, ISBN 0-07-034207-5.
Brian W. Kernighan and Dennis M. Ritchie, The C Programming Language, Prentice-Hall, 1978, ISBN 0-13-110163-3.
Brian W. Kernighan and Dennis M. Ritchie, The C Programming Language, Second Edition, Prentice-Hall, 1988, ISBN 0-13- 110362-8, 0-13-110370-9.
Donald E. Knuth, The Art of Computer Programming, (3 vols.), Addison-Wesley, 1981.
Andrew Koenig, C Traps and Pitfalls, Addison-Wesley, 1989, ISBN 0-201-17928-8.

P.J. Plauger, The Standard C Library, Prentice Hall, 1992, ISBN 0-13-131509-9.

Harry Rabinowitz and Chaim Schaap, Portable C, Prentice-Hall, 1990, ISBN 0-13-685967-4.

There is a more extensive bibliography in the revised Indian Hill style guide (see question 14.3).  See also question 17.31.


Thanks to Jamshid Afshar, Sudheer Apte, Randall Atkinson, Dan Bernstein, Vincent Broman, Stan Brown, Joe Buehler, Gordon Burditt, Burkhard Burow, Conor P. Cahill, D'Arcy J.M. Cain, Christopher Calabrese, Ian Cargill, Paul Carter, Billy Chambless, Raymond Chen, Jonathan Coxhead, Lee Crawford, Steve Dahmer, Andrew Daviel, James Davies, Jutta Degener, Norm Diamond, Jeff Dunlop, Ray Dunn, Stephen M. Dunn, Michael J. Eager, Dave Eisen, Bjorn Engsig, Chris Flatters, Rod Flores, Alexander Forst, Jeff Francis, Dave Gillespie, Samuel Goldstein, Alasdair Grant, Ron Guilmette, Doug Gwyn, Tony Hansen, Joe Harrington, Guy Harris, Elliotte Rusty Harold, Jos Horsmeier, Blair Houghton, Ke Jin, Kirk Johnson, Larry Jones, Kin-ichi Kitano, Peter Klausler, Andrew Koenig, Tom Koenig, Ajoy Krishnan T, Markus Kuhn, John Lauro, Felix Lee, Mike Lee, Timothy J. Lee, Tony Lee, Don Libes, Christopher Lott, Tim Love, Tim McDaniel, Stuart MacMartin, John R. MacMillan, Bob Makowski, Evan Manning, Barry Margolin, George Matas, Brad Mears, Bill Mitchell, Mark Moraes, Darren Morby, Ken Nakata, Landon Curt Noll, David O'Brien, Richard A. O'Keefe, Hans Olsson, Philip (, Andrew Phillips, Christopher Phillips, Francois Pinard, Dan Pop, Kevin D. Quitt, Pat Rankin, J. M. Rosenstock, Erkki Ruohtula, Tomohiko Sakamoto, Rich Salz, Chip Salzenberg, Paul Sand, DaviD W. Sanderson, Christopher Sawtell, Paul Schlyter, Doug Schmidt, Rene Schmit, Russell Schulz, Patricia Shanahan, Peter da Silva, Joshua Simons, Henry Spencer, David Spuler, Melanie Summit, Erik Talvola, Clarke Thatcher, Wayne Throop, Chris Torek, Andrew Tucker, Goran Uddeborg, Rodrigo Vanegas, Jim Van Zandt, Wietse Venema, Ed Vielmetti, Larry Virden, Chris Volpe, Mark Warren, Larry Weiss, Freek Wiedijk, Lars Wirzenius, Dave Wolverton, Mitch Wright, Conway Yee, and Zhuo Zang, who have contributed, directly or indirectly, to this article. Special thanks to Karl Heuer, and particularly to Mark Brader, who (to borrow a line from Steve Johnson) have goaded me beyond my inclination, and occasionally beyond my endurance, in relentless pursuit of a better FAQ list.

Steve Summit

This article is Copyright 1988, 1990-1995 by Steve Summit. It may be freely redistributed so long as the author's name, and this notice, are retained.
The C code in this article (vstrcat(), error(), etc.) is public domain and may be used without restriction.

The HTML annotation of this FAQ was done in March 1994 by Jutta Degener.
[down] [subview]