Mask-group

Passing Array to a Function in C



  • To reuse the array operation,we can create functions that receive arrays as arguments.

  • To pass an array in a function,we need to write the array name only in the function call.

  • functionname(arrayname); //passing an array 

  • There are 3 ways to declare function that receives array as arguments:

  1. return_type function(type array_name[])

  2. return_type function(type array_name[size])

  3. return_type function(type *array_name)

  • Example: