Difference between revisions of "Hello World in C"
From Free Knowledge Base- The DUCK Project: information for everyone
(New page: <nowiki>Hello World is the typical minimum-function program that prints a message </nowiki> <nowiki>and exits successfully. This is an example written in C.</nowiki> <nowiki></nowiki> ...) |
m (Protected "Hello World in C" [edit=sysop:move=sysop]) |
(No difference)
|
Latest revision as of 18:20, 20 June 2007
Hello World is the typical minimum-function program that prints a message and exits successfully. This is an example written in C. #include <stdio.h> int main(int argc, char *argv[]) { printf("Hello, world!"); exit(0); } The first line imports function declarations including printf(). The next line starts the definition of the main() function, which is called when your program is run. The curly braces enclose the contents of the main() function. The printf() call does the actual printing. The exit(0); line exits main() successfully. It could have just as easily have said return 0;, but the intent of exit() is more clear.