• admin@embedclogic.com

Function Calling with Array Input

You must be aware of the methods of function calling for better understanding of this topic. Array function call is the best example of the call by reference as we have to pass array reference only to access the complete array through the pointer.

Function call and definition as per Input array-

Function call is always based on your requirement. to work on array you may have one of the following requirments-

— You may need to write a function which takes a single element of an array as function Input.

Function Calling

Function Definition

— You may need to write a function which takes a whole one-dimensional array as function Input.

Function Calling

Function Definition

— You may need to write a function which takes a multi-dimensional array as function Input.

Function Calling

Function Definition

Note: 

— array_name ,&array_name[0] ,&array_name all represents the base address of an one dimensional array.

— (array_name+1)=(&array_name[0]+1) but not equal to (&array_name+1).

Program

Program to display an initialized array through an user-defined function display().

Output:

Subscribe and stay updated with our latest articles.