hello.c
From Club Ubuntu
A Hello World program in C:
#include <stdio.h>
int main(int argc, char **argv)
{
printf("Hello, World!\n");
return 0;
}
Explained:
- #include <stdio.h>: This instructs the preprocessor to include the standard library stdio.h header file. Header files contain function prototypes and other definitions, which are usable by the application programmer. In this case the stdio.h header contains function prototypes related to I/O routines. The printf function is found there.
- int main(int argc, char **argv) { ... }: This is a function definition for the main function. The main function is called and executed by the operating system when the program starts running. The function takes two arguments: argc which is the number of command line arguments given to by the user, and argv which is an array of strings, containing the values for the command line arguments.
- printf("Hello, World!\n"): Outputs the string Hello, World!\n to the standard output (usually the terminal). The last \n indicates a newline.
- return 0: Returns from the function main and returns 0 to the operating system.

