Passing array elements to functions

This tip submitted by Umer khan on 2010-10-27 21:19:28. It has been viewed 19642 times.
Rating of 5.5 with 179 votes



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]);






More tips

Help your fellow programmers! Add a tip!