I found this code on a q&a platform.
#include <iostream>
int main()
{
for (int i = 0; i < 300; i++)
std::cout << i << " " << i * 12345678 << std::endl;
}
At first sight, this seems normal but instead it runs infinitely. Results at : https://ideone.com/7F88MV
Now I changed the std::endl to "\n" and it behaved normal this time running for 300 times, terminating at i=299.
So what is going on with the std::endl keyword ?