#include <iostream.h>The output will beint i = 3; /* i is a global variable */
void fun(int a, int b)
{cout<<"Beginning of subprogram:"<<endl;i = b;
cout<<"a = " <<a<<endl;
cout<<"b = " <<b<<endl;
cout<<"i = " <<i<<endl;cout<<"Ending of subprogram:"<<endl;}
cout<<"a = " <<a<<endl;
cout<<"b = " <<b<<endl;
cout<<"i = " <<i<<endl;void main()
{
int list[5]={2, 0, 4, 5, 3};cout<<"Before call: \n";fun (i, list[i]);
cout<<"i = " <<i<<endl;
cout<<"list[i] = " <<list[i]<<endl;
for(int j=0; j<5; j++)
cout<<list[j]<<" ";
cout<<endl;cout<<"After call: \n";}
cout<<"i = " <<i<<endl;
cout<<"list[i] = " <<list[i]<<endl;
for(int k=0; k<5; k++)
cout<<list[k]<<" ";
cout<<endl;
Before call:After the call, actual parameter, i, will have the value of formal parameter, a.
i = 3
list[i] = 5
2 0 4 5 3
Beginning of subprogram:
a = 3
b = 5
i = 3
Ending of subprogram:
a = 3
b = 5
i = 5
After call:
i = 3
list[i] = 5
2 0 4 5 3