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. -->
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
>
15 <H2>section
1.8: Arguments -- Call by Value
</H2>
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,
27 (as is often the case)
28 you'll need an unmodified copy of the parameter later in the function.
30 </p><p>Don't worry too much about the exception mentioned for
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
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.)
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>
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>