Hey all,

When I write even a hello world script like below

#include <stdio.h>

int main(void)
{
printf("Hello World!\n");
return 0;
}

the windows command line flickers when trying to execute it, instead of staying there and showing me ?

Is there anyway to refresh or make this start coming up again.

Thank you

That happens when you run the program from an IDE that doesn't keep the window open or if you run the program by double clicking on an icon. It happens because the lifetime of the window is controlled by the lifetime of the program. When execution returns from main, the program ends and the window is destroyed.

The usual solution is to ask for input so that the lifetime of the program is dependent on the user:

#include <stdio.h>

int main(void)
{
  printf("Hello World!\n");
  getchar();
  return 0;
}

Thanks alot,

Yeah I figured it out by just getting a new IDE instead of Dev++.

> Yeah I figured it out by just getting a new IDE instead of Dev++.
That's a little drastic. ;) I'm sure some IDE advocates would love you to believe that switching is a walk in the park, but going from one IDE to another has a learning curve that's frustrating proportionally to how long you've been using the old IDE.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.