+ 1
Suppose a loop continuously printing something. Till how long it will continue to do so?
Is it related to hard drive size of computer?
2 odpowiedzi
+ 2
It will not stop. If you made an infinite loop, then your program will simply do just that. Games even run on loops, not infinite, but a LOT of loop iterations while the game is running.
The code playground doesn't allow infinite loops as it says time limit exceeded, but on any regular IDE, it will just be continuous output.
while (true)
{
std::cout << "hi";
}
+ 1
Till the output buffer runs out of memory it will execute. Memory is not infinite.