I\'m trying out Visual studio 2010 by compiling a C program. After it displays the solution in the \"DOS\" command window, the window is immediately closed. In Visual studio 200
You can add this function and call it right before returning from main():
void keep_window_open()
{
// clear buffer
fflush(stdin);
printf("Please enter a character to exit\n");
char ch;
ch = getchar();
return;
}
I adapted it from a C++ version in a utility header file at Bjarne Stroustrup's site: http://www.stroustrup.com/Programming/std_lib_facilities.h
If you start your application without debugger ("Start without debugging"), the console window will remain open until you press a key.