0

I have visual studio express 2013 for windows desktop installed and wrote first hello world world program. When I compile it it shows no errors. When I hit local windows debugger button the console window flashes with a result for 1/4 second and goes away. What should I do to keep it there so that when I program longer codes I won't have any difficulty.

Thanks.

juan.facorro
  • 9,791
  • 2
  • 33
  • 41

2 Answers2

0

Adding system("pause"); or int x; scanf("%d", &x); at the end of your main() function are popular options.

ppl
  • 1,120
  • 5
  • 18
0

Use the following template on your programmes, whenever you compile a C programme using Microsoft Visual Studio 2013:

//#define _CRT_SECURE_NO_WARNINGS
// un-comment the line above, if you want to
// be able to use functions like scanf instead
// of their more secure versions like scanf_s
#include <stdio.h>


int main( /* int argc, char ** argv */ ) {


    fflush( stdin );
    getchar( );
    return 0;
}

This is the most simple template you could use for MSVC 2013. Do not use fflush( stdin ); in anywhere else, it has no defined behaviour elsewhere, it is microsoft-specific.

Utkan Gezer
  • 3,009
  • 2
  • 16
  • 29