The first program in C

To write a program in c programming, we will need code editor which may be code block, dev c++, or another code editor.
as you download code editor one of them or another, install that properly on your system.

first of all, start the code editor and write a given program on that.

Structure of a C program

  • Header files
  • Main function

#include<stdio.h>
#include<conio.h>
int main(){
        printf("Hello, welcome to c programming.");
return 0;
}

Header file

The header file has extension .h which contains all the functions and macros which can be shared with other source files.
some basic header files are stdio.h and conio.h

stdio.h

acronym for standard input out header file which contains some basic functions printf() and scanf() functions.

printf()

printf() function is used to display output.

scanf()

scanf() function is used to get input from the keyboard by users.

 

conio.h

This header file stands for console input-output which contains two basic functions getch(), clrscr(), and others.

getch()

Basically used in the turbo c compiler, which is used to hold the output screen.

clrscr()

This function is used to clear the output screen.

Note: whenever you write a c program make sure to save the file with the extension .c

Post written by: Hemant Singh
© 2020 - 2020 All rights are reserved