X hits on this document

134 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 views134
Page views134
Page last viewedSun Dec 04 10:34:26 UTC 2016
Pages63
Paragraphs754
Words4119

Comments