X hits on this document

240 views

0 shares

0 downloads

0 comments

25 / 63

Copyright ©2004 Pearson Addison-Wesley. All rights reserved.

8-25

Arrays as Input Arguments

ANSI C provides a qualifier that we can include in the declaration of the array formal parameter in order to notify the C complier that the array is only an input to the function and that the function does not intend to modify the array.

This qualifier allows the compiler to mark as an error any attempt to change an array element within the function.

void foo(const int x[], int size)

The const tells C not to allow any element of the array x to change in the function foo.

Document info
Document views240
Page views240
Page last viewedTue Jan 24 21:29:46 UTC 2017
Pages63
Paragraphs754
Words4119

Comments