Writing Your First C Program

Before start learning about C Language, first lets create a small C program which prints something on output screen and exits. The code will be given below :
#include <stdio.h>

int main() {

  printf("Hello world.!!\n");
  printf("This is My First Program.\n");
  return 0;

}
Output :

Hello world.!! This is My First C Program.

Code Explanation :

  • The 1st line of the code #include <stdio.h> is a preprocessor command, which tells the compiler to include Standard library stdio.h file.
  • At 3rd line int main() statement is the main function where the program execution begins , and the opening curly bracket '{'at the current line and line closing bracket '}' at line 9, denotes the main function.
  • The function printf is a function of C language which is used to display the text and messages on output screen.
  • At 8th line, the return statement terminates the main() function and returns the value 0.