First Program in C

 First Program In C

C is simple and easy programming language. It is easy to learn. Here, we will discuss how to make a simple and first program using the C programming language. We need a Text Editor like Notepad, Notepad++ or an IDE like Turbo C  for writing C program. 

How to make a program :-

  • First we open a text editor and write the code.
  • After writing code then save your program with .c extension.
  • After save code we need to compile the code using alt+f9.
  • After compilation, finally run the whole code using ctrl+f9.

Structure of C program:- 

structure of C program

First C program-

#include<stdio.h>
int main()
{
printf(“Hello world”);
return 0;
}

Output-

Hello world

Explanation

  •  In the first line of a program we include stdio.h header file in program. stdio.h header file for standard input output.this is used for handle input output of a program.
  • The curly braces({}) is used for showing the beginning and ending of the Main Function,one braces for beginning and one for ending. It is used to set of all commands together.
  • main function is defined using the int return type. This is a standard. We can pass arguments in the main function, which is known as command line arguments. Main function is the starting point in every system.every C program requires a main function, without main function we cannot compile and execute a program.
  • printf() is used for displaying the output on screen.it is also print the character, str ing, float value, integer value on the screen, which is written in inverted commas (“ “). %d is used for print the integer value, %f is used for print the float value, %c is used for character value.