Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Learning C through K&R book

Name: Anonymous 2011-08-24 21:12

I already compiled and ran my first code but there's this thing.
When I run it, cmd flashes and disapears.(I'm using Dev-C++ on windows to make it)
Anyways, I think there was a command or function to make the cmd pause till I press enter or something like that so that I am able to read whatever the output was, the thing is, I cant remember the name of the function or how to write it.
Can one of you tell me which it is, if there is one.
BTW here's my code:


#include <stdio.h>

main ()
{
  printf("Hello World!");
}

Name: Anonymous 2011-08-31 15:59

About return(), you should always add return(0); (or return 0;) to the end of your main.

Not always. If the OP does any kind of non-trivial C program in the *nix environment, having the program return(0) may not actually terminate the process. That said, I would just follow what the various C standards say and use

exit(EXIT_SUCCESS);

instead of

return 0;

That way, you could be sure the program would behave as expected across various platforms.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List