C: use getch() or a breakpoint to view output

#include <stdio.h>

int main(void) 
{
   printf("Hello"); 
   return 0; 
}

OUTPUT

Hello

Save the program with a filename of “hello.c”. The program then needs to be compiled, linked and executed. Many compilers allow you to do this in one step but some require a multi-step process. Depending upon the compiler used, you may or may not see a display window with the message “Hello” appear and then disappear. There are several solutions to the disappearing window. The first solution is to insert a command to stop the program before it exits, which would keep the display window open. The two most popular methods are the following:

Option 1: Insert a getch() statement.

#include <stdio.h>
int main( void ) 
{
  printf("Hello");
  getch();
  return 0; 
}

OUTPUT

Hello

Option 2: Insert a system(“pause”) statement

#include <stdio.h>
int main( void ) 
{
  printf("Hello");
  system("pause");
  return 0; 
}

OUTPUT

Hello