you're setting n to be virtual memory address 5, because this memory isnt valid for your app you'll get a crash.
What you need to do is get some valid memory first, you've got two options - use the stack, or use the heap.
if you do something like the below you'll 'point' n at a stack variable, where you can then assign the value 5
int stackVar = 0;
int *n = &stackVar;
*n = 5;
the difference between the stack and heap is where the memory comes from - stack variables only live for the life of the function call. when the function returns the stack variables are "popped" and those pieces of memory are no longer valid. -- so from my example above, you could only use 'n' for as long as 'stackVar' is around, in this case until the point where you return from your function.
if you were to set
int *n = (int *)malloc(sizeof(int));
*n = 5;
you'll be creating a 'heap' variable that is sizeof(int) bytes large. this variable will last until you call 'free'
free(n);
keep in mind that doing this is somewhat heavy as extra bookkeeping memory is created in the call to 'new'. it wont be much, but it will be there. Usually you'll allocate larger classes/structs from the heap. one extra burden of using the heap is that you've got to remember to delete, else you'll 'leak'. I'm sure you've seen these before :-) the longer you run the app, the more memory it uses
does this make sense? :)