i have this question in mind since i first found out that you can declare and array like this

<type>* nArray

how does the compiler how much storage to allocate?
i've heard that it doesn't allocate any storage, it just points to some address and when you use index operator like this


it just returns the object n addresses far from the pointer.
if that's so, how does the compiler handle new(exact type of the array) variables declaration without risking an overriding of the memory:

int* nArray; // lets assume that it points to address 0x00000000
int nInt; // has the address of 0x00000004?
// that would mean like nArray + 1 points to nInt witch doesn't seem to be right

Pointers that are not set to NULL or a valid memory address are said to be wild pointers, they may be pointing at anything so are very dangerous.

The general rule is - Set a pointer to a valid memory address or set it to NULL...Always keep your pointers in a known state.

thx for the fast answer :)