Wednesday, March 23, 2016

a value in an array is passing to a function Example

                         A  value in an array is passing to a function Example 

#include
#include

int array_test(int arra[]);  // function
int main ()
{

     int line[5] = {10,20,30,40,50};        // array value named line
array_test(line );                           // array value passed to the function by function call
return 0;
getch();

}

array_test(int arra1[])        // function and declared an array named as arra1 to take the value from line
{
int i;
printf("arra value is  ");
for(i=4; i>-1; i-- )
          printf(" _%d ",arra1[i]);
return 0;
}


No comments:

Post a Comment