Docsity

C Pointer Exercises: Understanding Value and Effect of Pointer Operations, Exercises of C programming

Partial preview of the text

Download C Pointer Exercises: Understanding Value and Effect of Pointer Operations and more Exercises C programming in PDF only on Docsity!

Basic C pointer exercises

What is the value of *p?

p (of type _char_* ) 'h' 'e' 'l' 'l' 'o'

What is the value of p[4]?

p 'h' 'e' 'l' 'l' 'o'

What is the effect of *p = 'x'?

p 'h' 'e' 'l' 'l' 'o'

What is the effect of p = p+2?

p 'e' 'e' 'l' 'l' 'o'

What is the effect of p = &p[2]?

p 'e' 'e' 'l' 'l' 'o'