Program to illustrates Passing Array Elements to a Function (Call by Value)


    #include<iostream.h>
    #include<conio.h>
    void show( int ) ;
    void main( )
    {
        int number[ ]= { 11, 22, 33, 44, 55 } ;
        for( int i = 0; i <= 4; i++)
           show(number[i]);   //passing element of an array to the function
        getch( );
    }
        void show(int x)
    {
          cout<<"\t"<<x;
    }

No comments:

Post a Comment