Home >>C Tutorial >First C program
Before writing your first C program, users have to learn the initial three steps i.e. the way to write, compile and run the first C program.
In order to write your first C program, open the C console and type the following code:
#include <stdio.h> int main() { printf("Hello World"); return 0; }
Please note that the #include <stdio.h> includes the standard input output library functions. The printf() function is defined in stdio.h .
int main() : The main() function is basically the entry point of each and every program in the c language.
printf() : The printf() are the functions that are used to print the data on the console.
return 0 : The return 0 statement are used to return execution status to the OS. The 0 value is generally used for successful execution and 1 is used for the unsuccessful execution.
There are generally two ways by which you can compile and run the C program i.e by menu and by shortcut.
Click on the compile menu then compile the sub menu in order to compile the C program.
Followed by the first step, click on the run menu then run the sub menu in order to run the C program.
This is another method, press the ctrl + f9 keys to compile and run the program directly.
The following output will be displayed on the user’s screen.
Note:The user screen can be viewed at any time by pressing the alt+f5 keys.
Now, press the Esc button to return to the turbo C++ console.