Hello guys,

I m very much new on C. Need all of your help to improve. Right now I m getting one problem. I m writing the very basic program..

#include <stdio.h>

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

When I complie it is showing success. But when I Run this program its not showing me the dos screen properly. Just for a flash the dos screen coming and going off. Not getting the solution. Please help

John

Recommended Answers

All 6 Replies

#include <stdio.h>

int main() {
  printf("Hello World!\n");
  getchar(); /* waits until user enters a key if the standard input buffer doesn't contain any */
  return 0;
}
commented: amazing :-D +4

Ammazing. Its working Now. Many thanks Aia.

simply.

amazing.

:P

By the way blrjohn, you could also try and fire up a console and execute your program from there. It won't disappear then. I dunno on which OS you are, but guessing it's Windows (80% market share or something eh):

Go to:

Start -> Run

type in "cmd"

Hit enter.

Behold the almighty black screen with often blinking cursor! :D

Typing in "cd" and then a path will let you change your directory. Type in "help" if you're in need of more help. Mastering the console is pretty convenient for developers.

commented: This is how it should be done. +20

u can see ur result by pressing ctrl+f5 or u can see ur result by adding a simple "getch();"
in ur code...........................

commented: tk ur sms spk n gtfo -1

u can see ur result by pressing ctrl+f5 or u can see ur result by adding a simple "getch();"
in ur code...........................

Do you think every one in the world uses the same copiler/IDE that you use?
Your suggestions are not an improvement upon what it has been discussed already.

Welcome to the forum.
Avoid chat rooms speaking format next time you post. We can afford full words in English. There's not restriction about saving bits over here.

commented: Well said, totally right about that. +20
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.