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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

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

Post 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]);
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply