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


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

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|