+ 1
Memory allocation in while loop
Refer below code: #include <iostream> using namespace std; class Test { public: Test () {cout << "constructor" << endl;} ~Test () {cout << "destructor" << endl;} }; int main() { while(Test* obj = new Test()) { cout << "*****" <<endl; } return 0; } Above code is infinite loop as far as New operator allocates memory... Till what time i.e. how many memory allocation will succeed ?
1 Réponse
0
It allocate memory while your OS allow to it