#include <stdio.h>
int main(){
printf("Hello world \n");
}
In the command line do the following (while in the file directory):
gcc hello-world.c
./a.out
stdio.h
is a standard C library to be includedmain()
is the function which is executed by C compiler each time the program in C is run. In case another function is to be called, it can be called via main.printf
prints the output on the screengcc hello-world.c
creates output file a.out. This command converts the high level language written in C to binary for out computer to understand it./a.out
is run to see the output#include
is the pre-processor directive which will fetch the filestdio.h
for predefined functionalities of C
#define
is another preprocessor used in C discussed ahead
gcc -Wall -save-temps hello-world.c
is used to see all the temporary files that are created while a C program in executed and converted from high level language to assembly language to machine code and finally to the output