How to Pass the array elements to functions?

0 votes
29 views
asked Dec 19, 2013 in C++ by anonymous
HI all

  How to Pass the array elements to functions?

1 Answer

0 votes
answered Dec 19, 2013 by Umer Khan

When you pass full array as argument it passes as reference and their is no need of address operator(&), but when you pass a single array element it passes by value and you have to use address operator to pass it by reference (&) 

Passing full array 
 

fun(a);



Passing element of array 

fun(&a[3]);
 
...