The very basics of C

C language is function based programming language. C program itself is a function. Usually parameters to C function are passed as arguments. Function consists of a name followed by the parentheses enclosing arguments or an empty pair of parentheses if there are not arguments required. If there are several arguments, they are separated by commas.

The mandatory part in C program is main function. This function must be included in every program because this is a first function which is run after execution of program.

Lets take an example:


#include <stdio.h>

int main(void)


printf(“Hello world!\n”);

return 0;



This is a very basic C program, but it contains all necessary elements of it. Lets examine a little bit what we have written here...

#include <stdio.h> - is a preprocessor command. All preprocessor commands are identified by # sign at the beginning of the line. #include command tells preprocessor to open file stdio.h and from it necessary stored parts while compiling program. The file name is surrounded by brackets “<>”. Bracket marks“<>” tels the preprocessor to search for the file in the region defined by operating system variables (for instance “path” variabel in Environment variables). If double quotes are used instead of bracket marks then file searching is done only in default directory of project.

Next line is int main(void). It is always necessary to define the type of function return type and of course function has an arguments. The type int is showing that main function returns an integer and no arguments to the function is needed.

Opening brace “{” indicates the beginning of the block of sentences. On of those sentences is printf(). This function is taken from stdio.h library and writes a message to computer terminal (this case screen).

Return 0 is returning parameter to the function. And every function should end with closing brace “}”.

  “/*” is commenting the line. This means that line marked with “/*”is not included in compilation.