lab#3

5
LAB#3 Pointers

Upload: echo-branch

Post on 30-Dec-2015

20 views

Category:

Documents


1 download

DESCRIPTION

LAB#3. Pointers. Ex1: What is the output of the following code ?. firstvalue is 10 secondvalue is 20. Ex2: What is the output of the following code ?. firstvalue is 10 secondvalue is 20. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: LAB#3

LAB#3Pointers

Page 2: LAB#3

Ex1: What is the output of the following code?

firstvalue is 10secondvalue is 20

Page 3: LAB#3

Ex2: What is the output of the following code?

firstvalue is 10secondvalue is 20

Page 4: LAB#3

Ex7: introduce int variables x and y and int* pointer variables p and q. Set x to 2, y to 8, p to the address of x, and q to the address of y. Then print the following information:• The address of x and the value of x.• The value of p and the value of *p.• The address of y and the value of y.• The value of q and the value of *q.• The address of p (not its contents!).• The address of q (not its contents!).

Page 5: LAB#3