What does this program?

Oct 11, 2015 at 2:47pm
Hi! I saw a picture with a program and i am wondering what it does. I tested and it freezes the .exe. Can you tell me why?

1
2
3
4
5
6
7
8
#include <iostream>
using namespace std;
int main;
{for(; ; )
cout<<'\a';
return 0;
}
  
Oct 11, 2015 at 2:47pm
Aside from the typos making this an invalid program, it creates an infinite loop that outputs the '\a' character infinitely.

Recall that in a for loop, all three parts are optional.
Last edited on Oct 11, 2015 at 2:48pm
Oct 11, 2015 at 2:52pm
Thanks for you very very fast response! :D
Topic archived. No new replies allowed.