shutdown program and close console window

Hello, I want my console application to close instead of returning 0. How do i close the console window, not hide it, but actually close the program? Thank you :D
exiting main() with return 0 will actually close the program.

1
2
3
4
int main()
{
  return 0;  // program ends/closes here
}
The existance of the console window is unrelated.

If Windows spawns one for you, so that your program will run, then Windows will get rid of the console once your program terminates. If the console window existed before you started your program, then it will continue to exist after your program terminates.

Hope this helps.
Topic archived. No new replies allowed.