Just been reading about the new and delete keywords and i made the following simple code
Notice i havent used a delete here to free the memory.Code:// dynamic memory allocation #include<iostream> using namespace std; int main(void) { int* pAge=new int; if(pAge == 0) { cout << "Sorry no memory available!" << endl; return(0); } *pAge=27; cout << "Address=" << pAge << endl << "Contents=" << *pAge << endl; return(0); }
How come this doesnt prompt an error or at least a warning on my compiler ?(MSVC++ 6.0)
I would have thought whereever there is a new there must be a delete ?