Home C Programming Language

Getting Started with C

The C program is a set of functions and the program execution begins by executing the function main. Here is the classical and famous "hello world" program which prints "hello world" greeting to screen.

#include <stdio.h>
main()
{
    printf("Hello World!\n"); 
    return 0;
}

The first line is the the #include directive. C program uses this directive to load external function library - stdio is c library which provides standard input/output. printf is a function which is declared in stdio.h

The next is the function main - the first entry point of all C programs. C program logic starts from the beginning of main function to the its ending.

And finally is the printf  function which accepts a string as its argument and print it to screen.