## Passing array element by element to function :

1. Individual element is passed to function using Pass By Value parameter passing scheme
2. Original Array elements remains same as Actual Element is never Passed to Function. thus function body cannot modify Original Value.
3. Suppose we have declared an array ‘arr’ then its individual elements are arr,arr…arr. Thus we need 5 function calls to pass complete array to a function.

## Tabular Explanation :

Consider following array

```int arr = {11,22,33,44,55};
```
Iteration Element Passed to Function Value of Element
1 arr 11
2 arr 22
3 arr 33
4 arr 44
5 arr 55

## C Program to Pass Array to Function Element by Element :

```#include< stdio.h>
#include< conio.h>
//---------------------------------
void fun(int num)
{
printf("\nElement : %d",num);
}
//--------------------------------
void main()
{
int arr,i;
clrscr();
printf("\nEnter the array elements : ");
for(i=0;i< 5;i++)
scanf("%d",&arr[i]);

printf("\nPassing array element by element.....");

for(i=0;i< 5;i++)
fun(arr[i]);

getch();
}
```

## Output :

```Enter the array elements : 1 2 3 4 5
Passing array element by element.....
Element : 1
Element : 2
Element : 3
Element : 4
Element : 5
```

## Disadvantage of this Scheme :

1. This type of scheme in which we are calling the function again and again but with different array element is too much time consuming. In this scheme we need to call function by pushing the current status into the system stack.
2. It is better to pass complete array to the function so that we can save some system time required for pushing and popping.

[box]
We can also pass the address of the individual array element to function so that function can modify the original copy of the parameter directly. [See : Parameter Passing – Pass by Address]
[/box]

## Live Example 2 : Passing 1-D Array Element by Element to function

```#include<stdio.h>

void show(int b);

void main()
{
int arr = {1,2,3};
int i;
for(i=0;i<3;i++)
show(arr[i]);
}

void show(int x)
{
printf("%d ",x);
}
```