Tuesday, January 22, 2008

CSE 2031 Lecture 5

void makeDouble(int* x)


    *x = 2* *x;



* modifies a pointer

This in English is makeDouble takes an integers pointer

Then the integers pointer is modified.

An '&' sign is a pointer. int I, *p; /* means that there is an integer I and an integer memory reference *p;

An expression has a type and value.

*(r=&j) *= *p

**p dereferences p


Pointer to void

  • Why do pointers have types?
    • So we can dereference them

No comments: