C language Tutorial – Introduction

Introduction – C language

C is a general-purpose procedural programming language. It was designed and written by Dennis Ritchie at AT & T’s Bell Laboratories of the USA in 1972.
To learn C++ or Java or any other programming language, first of all, you need to have some basic knowledge about keywords, variables, data types, loops, functions, arrays and pointer etc. These concepts can be easily understood with languages like C language. So, people always prefer to start programming career with C Language. So, lets start.

Why C language is so popular?

There are many reasons for popularity of C language. But the most important feature of C language is that it lightening fast. Code runs faster than any other high level languages like Java, Python etc.

Why is C language more popular than other programming languages

  • C is simple, reliable, and easy to use.
  • Also easy to learn.
  • Process-oriented language.
  • C programs are efficient, fast and highly portable.
  • It is collection of library function
  • C is easily extensible.
  • For many programming language C is building block.
  • All UNIX application programs, C compiler, Windows, Linux are essentially written in C.
  • It is invented to write a UNIX operating system.

Features of C programming language

Following are some features of C language:

  • C is a structured language.
  • Basically, C is coded in assembly language. i.e C compiler is written in assembly language.
  • C is a case-sensitive language.
  • In C there are a fixed number of keywords.
  • There are number of arithmetic and logical operators use in programs.
  • C has collection of built-in functions.
  • For developing an operating system C language is widely used.
  • There are a variety of data types.
  • C is a platform dependent programming language.
  • In C we use Pointers so we can directly interact with memory.
  • It is a robust language as a result, a system is not wholly affected by single program failure.
  • C uses a top-down approach, means program executed from top to bottom.

First C program

let’s see the first program in C

Don’t worry, if you didn’t understand the code. We will look into the details soon in coming posts.

Rules applicable to all C programs:

  • In a C program, each instruction is written as a separate statement. Therefore a complete C program would comprise of a series of statements.
  • The statements in a program must appear in the same order in which we wish them to be executed.
  • All statements are entered in small case letters.
  • C has no specific rules for the position at which a statement is to be written. Therefore it is called a free-form language.
  • Every statement in C must end with a ; (semicolon). Thus ; acts as a statement terminator.
  • The comment about the program should be enclosed within /* */ as shown in above program.
  • Comments are not compulsory.
  • You can write any number of comments.
  • You can give comments at any place in the program either before the statement, after the statement or within the statement as shown below:
  • Comments cannot be nested.

    is invalid.
  • You can write comments on more than one like. So this type of comments is called as multi-line comments. For example,
  • All statements that belong to main( ) are enclosed within a pair of braces { } as shown below.