C language > Beginner questions

Hello.c

(1/1)

tconejr:
When I double click the EXE created from the Hello.c sample program, the program flashes on screen and then closes.  What's the recommended approach to telling the console window to remain open until the user presses a key?  At my age I'm not quick enough to read the "Hello, world" before the window closes.  :)

frankie:
Wait for a key before to close, to do this add following lines at the end of the function main:

--- Code: ---  printf("Press <return> to exit.....");
    getchar();
--- End code ---

tconejr:
Thanks!

Navigation

[0] Message Index

Go to full version