Question

8 Suppose the following declarations and statement are in effect. What are the values of x and y in each case? *p *q; = (b) int x = 1, y = 3, *m = &x, *n = &у; *n = 5; *a += 2; (8)Please solve written in details. (4)Notice the semi colon and explain. PLEASE NO CODING(both) 4 Determine the output produced by each of the following statements: (a) for (i = 6; 1 > 0;-1) print (-) (b) for (i 0;! >= -6; --1); =

0 0
Add a comment Improve this question Transcribed image text
Answer #1

QUESTION (8)  

(a) x=12 and y=12

*p and *q are declare as pointer type so *p=&x means *p holds the address of x and *q=&y means *q holds the address of the y so *p=*q means assign the value of *q into *p so *p hold the value 12 , *p and x both are point the same memory location and *p as pointer type so changes in *p is parmanently so value of x also will be change

(b) x=2 and y=5

*m and *n are declare as pointer type so *m=&x means *m holds the address of x and *n=&y means *n holds the address of the y so *m=*n means assign the value of *n into *m so *m hold the value 3 , *m and x both are point the same memory location and *m as pointer type so changes in *m is parmanently so value of x also will be change so final value of *m will be 2 and *n will be 5 so x and y also hold 2 and 5

(c) x=8 and y=5

*a and *b are declare as pointer type so *a=&x means *a holds the address of x and *b=&y means *b holds the address of the y so *a=*b means assign the value of *b into *a so *b hold the value 6 , *a and x both are point the same memory location and *a as pointer type so changes in *a is parmanently so value of x also will be change so final value of *a will be 8 after 2 add in *a, and *b will be 5 after 1 decrement so x and y also hold 8 and 5

QUESTION (4):

(a) OUTPUT : ------

in this statement for loop exicute six time so six time print "-"

Add a comment
Know the answer?
Add Answer to:
8 Suppose the following declarations and statement are in effect. What are the values of x...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT