your 'pi2' (and therefore your 'pi') pointer don't actually point to anything.
A pointer tells the compiler where to look for another variable. That is, it "points to" that variable.
1 2 3 4
int* pi2 = 0; // here you are making a pointer point to null (nothing)
*pi2 = 1024; // this attempts to put the value of 1024 in whatever variable
// pi2 points to. But since pi2 points to nothing, this is trying to put 1024 in 'nothing'
// which will likely cause your program to crash
To make this work, you pointer has to actually point to something:
1 2 3 4 5 6 7 8
int variable = 0; // a variable
int* pointer = &variable; // a pointer that points to 'variable'
*pointer = 5; // assign 5 to whatever 'pointer' points to
// (ie, since pointer points to variable, this effectively is like saying
// variable = 5;)
cout << variable; // prints 5