What does the following program print Write a C program incl

What does the following program print? Write a C program: #include Void main() {int*p1*, p2, *p; Int a = 5, b = 8; p1 = &a; p2 = &b; if(a

Solution

Answer:

8 5

5 8

At line 3, a and b values are 5 and 8

at line 4, we assigned a and b variable references to p1 and p2.

sp now p1 value is 5 and p2 value is 8

at line 5, a<b condition will return true so here inside the if condition, we are swapping p1 and p2 value s by using the variable pointer p.

so now p1 value is 8 and p2 value is 5

at line 6, p1 and p2 values will print like 8 and 5

at line 7, a and b values will print like 5 and 8

 What does the following program print? Write a C program: #include Void main() {int*p1*, p2, *p; Int a = 5, b = 8; p1 = &a; p2 = &b; if(aSolutionAnswer

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site