C Tutorial For beginners | Learn C Programming Language

C Tutorial For beginners | Learn C Programming Language

14 July 2023 0 By Anshul Pal

C Language is a programming language which was developed by AT & T’s Bell laboratories  of USA in 1972. It was designed and written by Dennis Ritchie.

C programs are built from small and manageable segments which are known as modules. Each modules is designed and developed to perform a specific task. If you want to see a complete C program then it is constructed by linking many modules. Usually a module should accept data, operate on data and then return a result.

A module should preferably handle at the most one or two tasks of those required by completed program.

Characteristics of ‘C’ Language

  • C program may have any numbers of blank lines  and blank spaces between words and statements.
  • Pointer implementation is available to address any location in the memory and ability to perform pointer arithmetic.
  • Software modularization.
  • Its a format free language. No line numbers are needed.

Applications of C Language

  • Now a days C is a specially used for embedded system programming.
  • Almost 90 percent of Unix O/S is designed in C language.
  • It supports low level programming by providing TSR concepts (test and stay resident programs).
  • It can also be used for bit level manipulations.

Advantages of ‘C’ :

  1. Machine Independence : Being a high level language, it is machine independent
  2. Economy of Expression : C is a compact and coherent programming language. The code is quite cryptic, so that small length of code can perform complex tasks.
  3. Data Structures : There are variety of ways to store data in C which allows easy access to data.
  4. Operator Richness : C supports a wide range of operators to handle arithmetic and logical calculations.

Disadvantages of ‘C’ :

  1. Difficult to Debug : C gives a lot of freedom to the developers, but it appears bit complex for a newcomer to find, what is wrong with a program.
  2. Loosely Syntaxed : C allows a lot of freedom in coding. We can put end of statements symbols (;), blanks lines, white spaces anywhere, we want in the program. There is no fixed place to start or end a line. This can give rise to code that is difficult to understand by reading.

Why C is known as structured languages?

C programming languages follows the technique of structured programming for developing its programs. The basic idea behind this technique is that any part of the program can be represented by elements from three basic logic structures. Each structure has single entry and single exit.

History of C

The concept of computer language had come around 1960, but the language developed at that time were designed specially for specific purpose such as FORTRAN for scientific programming, COBOL for commercial business programming etc. Then, the international committee was founded to develop a language useful for different purposes. This committee had developed a general purpose language named ALGOL 60. A new language called Combined Programming Language (CPL) was developed by Cambridge University in 1963. But, it was hard to learn. So, another  language named BCPL (Basic Combined Programing Language) was developed by Martin Richards in 1967. The another language named ‘B’ was also developed by Ken Thompson at AT & T’s Bell Laboratories. At that time, C was used to develop an operating system UNIX and became very popular.

Format of C Program :

To write a C program, we first create functions and then put them together. A C program may contain one or more sections.

Documentation section
Link Section
Definition Section
Global Declaration Selection
Main ( ) Function Section
 Declaration part
Executable Part
Sub Program section
(User-defined functions)

The documentation section consists of a set of comment lines giving the names of the program, the author and other details, which the programmer would like to use later. The link section provides instructions to the complier to link functions from the system library. This definition sections defines all symbolic constants.

There are some variables that are used in more than one function. Such variables are called global variables and are declared in the global declaration section that is outside of all the functions. This section also declares all the user-defined functions.

Every C program must one main ( ) function section. This section contains two parts, declaration part and executable part. The declaration part declares all the variables used in executable part. There is at leased one statement in the executable part. These two parts must appears between the opening and the closing braces. The program execution begins at the opening braces and ends at the closing braces. The closing brace of the main function section is the logical end of the program. All statements in the declaration and executable parts with a semicolon.

The subprogram section contains all the user defined functions that are called in the main functions. User defined functions are generally placed immediately after the main functions, although they may appear in any order.

All sections, except the main functions sections  may be absent when they are not required.

C program to adding Two Integers

Program for adding two integers in C language. its is a Arithmetic operation to adding two integers in C. If the two numbers have given  by the users then the code for adding two numbers is :-

Firstly include the header file then we add int main function and considering that  the two given numbers is integer now  by using the printf function we are telling the complier that take the first number from user and by scanf function the complier reads this and knowing that the given value is integer, float or which type Now, similarly all those steps for numbers b;

Now, we declaring the third variable which is telling to the complier that add the first and second number and print their sum and the return zero function is showing that the complier read the code with returing zero errrors.

// Program for adding two numbers in C language
int main() {
  int a, b;
  printf("enter the value of a\n");
  scanf("%d", &a);
  printf("enter the value of b\n");
  scanf("%d", &b);
  int sum = a + b;
  printf("sum is : %d", sum);
return  0;


Enter the value of a : 5
Enter the value of b : 3
Sum is : 8


Similarly in this way we can add many numbers in C by using the given format of code. So it is so easier to add numbers in C programming Language.

We hope that you like the tutorial of C Programming Language. If you have any queries than please leave down a comments below. Thanks For Reading!

Suggested Readings!