* remove "\r" nonsense
[mascara-docs.git] / C / the.ansi.c.programming.language / notes.accompany.ansi.c / sx4l.html
blob8c9b2d2bdb18ef4c2b0d0a1e48f1dae6977a4628
1 <!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
2 <!-- This collection of hypertext pages is Copyright 1995, 1996 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>section 1.8: Arguments -- Call by Value</title>
10 <link href="sx4k.html" rev=precedes>
11 <link href="sx4m.html" rel=precedes>
12 <link href="sx4.html" rev=subdocument>
13 </head>
14 <body>
15 <H2>section 1.8: Arguments -- Call by Value</H2>
17 page 27
18 <p>If,
19 on the other hand,
20 you are <em>not</em> used to other languages such as Fortran,
21 these call-by-value semantics may not be surprising
22 (any more than anything else in C which is new to you).
23 </p><p>Even though you <em>can</em> modify a parameter in a function
24 (i.e. treat it as a ``conveniently initialized local variable''),
25 you certainly don't have to,
26 especially if
27 (as is often the case)
28 you'll need an unmodified copy of the parameter later in the function.
29 </p><p>page 28
30 </p><p>Don't worry too much about the exception mentioned for
31 arrays--there
32 are a number of exceptions for arrays, and we'll have much more
33 to say about them later.
34 But be aware that we are deliberately glossing over a few details here,
35 and they are details which will be come important later on.
36 (In particular, the statement on page 27 that ``the called
37 function cannot directly alter a variable in the calling
38 function'' may not seem to be true for arrays, and this is
39 what the authors mean when they say that ``The story is
40 different''.
41 We'll be seeing several functions which return
42 things--usually strings--to
43 their callers by writing into caller-supplied arrays.
44 In chapter 5 we'll learn how this is possible.
45 If this discrepancy wouldn't have bothered you now,
46 pretend I didn't mention it.)
47 </p><hr>
48 <p>
49 Read sequentially:
50 <a href="sx4k.html" rev=precedes>prev</a>
51 <a href="sx4m.html" rel=precedes>next</a>
52 <a href="sx4.html" rev=subdocument>up</a>
53 <a href="top.html">top</a>
54 </p>
55 <p>
56 This page by <a href="http://www.eskimo.com/~scs/">Steve Summit</a>
57 // <a href="copyright.html">Copyright</a> 1995, 1996
58 // <a href="mailto:scs@eskimo.com">mail feedback</a>
59 </p>
60 </body>
61 </html>