C++ for (double i=0; i<100000000; i++){ int *p = new int[100000000]; delete p; }
Which of the following statement(s) is/are correct?
There is a run-time error |
||
There is a syntax error |
||
There is a memory leak |
||
There is no error |
answer: option d) There is no error
EXPLANATION:
Since, double datatype also belongs from the family of integer datatype but having a higher size and range as compared to integer.
Therefore like integer varable, double variable is also iteratable in for loop and do not give any error.
For your understanding and confirmation, I have compiled this code on c++ compiler. As you can see that, the compiler doesnt give any error.
Get Answers For Free
Most questions answered within 1 hours.