Basic of C language

  • C  is a basic programming language and most commonly used programming language.
  • C is known as structured high level language.
  • C programming language is purely a procedural oriented language because it is mainly focuses on the procedures in which we write the program.
  • C first developed by Dennis Ritchie at At and T bell Laboratory in US.
  • We write c program to perform different task and their is a compiler  which checks and execute the program and produce the output.

C program structure :

As we write the code in c. Their is some well defined structure to write code which is as follow.

123456#include<stdio.h>//include external filesvoid main(){//Code}

In above c program structure first line is a preprocessor directives files.

Preprocessor directives file: These are the first statement of c code. Preprocessor directives tells the compiler to include the standard input and output file. ( or which is used to include the library files such as standard input and output file)

Second,  is the external files after library file we include the external files to our program.

Then the actual start of our program void main() indicates the starting point of program from which the code execution starts.void states that this method does not return anything, main indicated its main method and the () indicates that function does not accept anything (sometimes main accepts parameters)

The curly braces {  } is used to bind our all code statements.

Writing first program:

123456#include<stdio.h>void main()        {                printf(“Programming in c “);            }

In above our first program First line includes the input and output library.

during #include preprocessor tells the compiler to include the i/o library in program.

Second line is the start of the program from which execution starts . next is our program statement printf is the function which is used to output the statement to the screen, the semicolon after the printf function indicates the end of the statement.

The output of the above program is :    Programming in c


Leave a Comment

Your email address will not be published. Required fields are marked *