Page 1 of 1

What will be displayed in the screen after the following program executes, provided the formal parameter denoted with &

Posted: Thu Jun 02, 2022 7:56 am
by answerhappygod
What will be displayed in the screen after the
following program executes, provided the formal parameter denoted
with & will be transferred by:
a. value
b.value/result
c. reference
d. name
CODE:
int a[5];
int i,X=1;
void swap (int&a, int&b,int&c)
int t;
{
c++;
t = a+X+c; a = b; b = t;
}
void main()
{
for (i=0;i<5;i++) a =
6 – i;
i = 2;
swap(i, a,X);
printf(ā€œ%d%d%d%d%d%dā€,i,a[0], a[1], a[2], a[3], a[4]);
}