simple Pointer initialization

Viewed 72623

It has been a while that I used pointers and I just wanna quickly check how I can initialize an integer pointer?

a) int *tmpPtr = 0;

b) int *tmpPtr = null;

c) int a = 0;
   int *tmpPtr = &a;

EDIT

Thanks for all your answers so far. The funny thing is, that if I intitalize the pointer as follows, then the mem::copy operation works fine.

int tmp = 0;
int *tmpPtr = &tmp;
Mem::Copy((void*)tmpPtr, basepointer(), sizeof(int));

However, if I do it like this:

int *tmpPtr = 0;
Mem::Copy((void*)tmpPtr, basepointer(), sizeof(int));

then I get a crash during mem::copy...

Weird!

7 Answers
Related