* some tutorial and the ansi C book
[mascara-docs.git] / C / the.ansi.c.programming.language / c.programming.notes.int / sx11.html
blob0ea03c6cedfd99d6e1d0d1d3ef17d14c4032d2c4
1 <!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
2 <!-- This collection of hypertext pages is Copyright 1995-7 by Steve Summit. -->
3 <!-- This material may be freely redistributed and used -->
4 <!-- but may not be republished or sold without permission. -->
5 <html>
6 <head>
7 <link rev="owner" href="mailto:scs@eskimo.com">
8 <link rev="made" href="mailto:scs@eskimo.com">
9 <title>Chapter 25: Variable-Length Argument Lists</title>
10 <link href="sx10c.html" rev=precedes>
11 <link href="sx11a.html" rel=precedes>
12 <link href="top.html" rev=subdocument>
13 </head>
14 <body>
15 <H1>Chapter 25: Variable-Length Argument Lists</H1>
17 <p>
18 All of the functions we've written so far
19 have taken a fixed number of arguments,
20 and we've been careful to call the functions
21 always passing them the correct number of arguments,
22 and we've been tending to use
23 explicit function prototype declarations
24 so that the compiler can verify
25 that we call functions with the correct number of arguments.
26 But what about <TT>printf</TT>?
27 Sometimes we call it with one argument,
28 but often we pass it additional arguments.
29 Why doesn't the compiler complain?
30 How can <TT>printf</TT> access the extra arguments we pass to it,
31 when it can't know how many of them there will be
32 or what types they will have,
33 such that it can't possibly declare
34 conventional function parameters for them?
35 </p><p>In this chapter we'll discuss the <dfn>variable-length argument lists</dfn>
36 (often discussed under the shorthand term ``varargs'')
37 which allow functions such as <TT>printf</TT> to be written.
38 </p><p><a href="sx11a.html" rel=subdocument>25.1 Declaring ``varargs'' Functions</a></p>
39 <p><a href="sx11b.html" rel=subdocument>25.2 Writing a ``varargs'' Function</a></p>
40 <p><a href="sx11c.html" rel=subdocument>25.3 Special Issues with Varargs Functions</a></p>
41 <hr>
42 <p>
43 Read sequentially:
44 <a href="sx10c.html" rev=precedes>prev</a>
45 <a href="sx11a.html" rel=precedes>next</a>
46 <a href="top.html" rev=subdocument>up</a>
47 <a href="top.html">top</a>
48 </p>
49 <p>
50 This page by <a href="http://www.eskimo.com/~scs/">Steve Summit</a>
51 // <a href="copyright.html">Copyright</a> 1996-1999
52 // <a href="mailto:scs@eskimo.com">mail feedback</a>
53 </p>
54 </body>
55 </html>